rancher / rke

Rancher Kubernetes Engine (RKE), an extremely simple, lightning fast Kubernetes distribution that runs entirely within containers.
Apache License 2.0
3.22k stars 584 forks source link

Question about image pull policy #1356

Closed franck-mosse closed 1 year ago

franck-mosse commented 5 years ago

RKE version: v02.2

Rke deploys the metrics-server with an imagePullpolicy set to Always. As my cluster does not have access to internet , the deployment fails and the metrics server does not start becouse the image can not be pulled from ouside the cluster. Is there a way to update the default image policy at cluster deployment ?

For information, my cluster is based on VMs build with packer and each of them contains all the rke pre-requisites (docker images used by rancher are still loaded in the local docker registry of each vm).

For the moment my work arround is to patch dynamically the deployment of metrics-server after k8s instanciation but want to avoid this.

I cannot use the Air-gapped mode with a registry outside of my cluster but i have a private docker registry inside my cluster deployed on each master.

alena1108 commented 5 years ago

We should review our addons and inherit image pull policy from k8s api property.

moelsayed commented 5 years ago

@franck-mosse Rke should always use the configured private registry for all the images it requires. How do you use the private registry with your setup ?

deniseschannon commented 5 years ago

@franck-mosse is the metrics-server in your docker registry?

we should check that metrics-server is listed as a required image

franck-mosse commented 5 years ago

@deniseschannon All the required images are loaded in the docker internal registry of all our VMs where we would like to deploy K8S with RKE. We don't have any external registry to connect to at k8s installation step. All images needed are still uploaded in the Vms at build stage, and when the vm is up all images are still available in docker. The problem is that imagePullPolicy is set to 'Always' by default and this implies a check of the image version at pod deployment. An 'IfNotPresent' imagePullPolicy will not generate the issue.

aegoetha commented 4 years ago

We have the same usecase as @franck-mosse, we preload all containers on the internal docker registries of the VM's so we don't need a private registry. The metrics-server will always try to pull the image, even if it is already present on the machine. Is it possible to add an option to change the imagePullPolicy of the metrics-server in the configuration yaml file of the RKE cluster?

davidcorbin commented 4 years ago

Bump this issue; we have the same problem. Would be nice to have a configurable global default image pull policy.

timarnson commented 4 years ago

We also have this same issue.

The following work-around will patch the pull policy: kubectl patch Deployment/metrics-server -n kube-system -p '{"spec": {"template": {"spec":{"containers":[{"name":"metrics-server","imagePullPolicy":"IfNotPresent"}]}}}}'

jimmyw86878 commented 3 years ago

We still get the same issue here.

All system needed image are loaded previously on the host for deploying RKE. However, only metrics-server is trying to pull image and failed because of setting the imagepolicy to always. I can manually modify the yaml of deployment to fix it but I think there should be another way to change default config.

jarrettprosser commented 3 years ago

Yes, I've come across this issue as well in an air-gapped deployment. Thanks @timarnson for the simple patch command. It would be great to have this as a config option in the RKE deployment so we don't need the manual step.

superseb commented 1 year ago

This should be solved in v2.6 and v2.7