I have a question regarding the Kubernetes Nodes images being available to other nodes when using buildkit-cli-for-kubectl. I have a weird case where I build an image with no problem. The image actually works on the node that it is sent to by "kubectl build". But putting affinity to one of the other K8s Nodes does not work, I get "ImagePullBackOff". I guess I was assuming that nodes will get from each other any images they lack but that is not the case.
When running this command on SRV-008 it exports the layers to SRV-009 but I have 3 modes in my cluster. How can they have built this for only transferring to one node? I find it weird because if it can transfer to one of the nodes in the K8s cluster then why not the others?
root@SRV-008:/mnt/kubernetes/ubuntu1604_jdk8# kubectl build -f Dockerfile . \
--output type=image,name=docker.io/library/ubuntu1604_jdk8:1.0.0
Is there something I am missing? I have looked in all the documentation about buildctl but nothing about how to get the built image onto all K8s nodes.
Any help would be appreciated.
So I figured out how to do this. below is all I did, of course change to your needs.
Blog I found where the answer was hiding.
https://blogs.vmware.com/opensource/2020/11/17/buildkit-cli-for-kubectl/
Where the project lives
I am working with Linux servers. The key here is the replicas count!
cd to the folder where your Dockefile is located.
In each of the K8s Nodes yo will see the image you just built.
buildkitd.toml file contents. Make any other changes you need here.
Command to delete the buildkit pods after you build your image.