0

I have K8S cluster on machine(CentOS) which is not connected to internet, I mostly get docker images from the online machines and load like docker load -i myimages.tar.gz and add imagePullPolicy: IfNotPresent in manifest.yaml. It works fine.

Now i am testing Percona XtradbCluster Operator which has imagePullPolicy: Always as i cant change this and i am getting below error

Error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:54103->[::1]:53: read: connection refused

How i can make changes on docker or kubernetes so it only get images locally without changing imagePullPolicy?

Update1: I tried to patch statefulset but it didn't work as these resources are directly managed by operator so after my changes operator override it immediately

 kubectl patch statefulset cluster1-pxc -p '{"spec": {"template": {"spec":{"containers":[{"name":"pxc","imagePullPolicy":"Never"}]}}}}' 
ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74
  • You can run a pod manually based on a specific image (without manifest) which allows you to set the policy, if that helps `kubectl run pod podname --image=image-name --image-pull-policy=IfNotPresent --generator=run-pod/v1` – Son Nguyen Jun 18 '20 at 15:10
  • But these pods get launched by StatefulSet and that StatefulSet manifest get create dynamically by Operator code. – ImranRazaKhan Jun 18 '20 at 15:13
  • Can you `kubectl edit statefulset ss-name` and change the policy? – Son Nguyen Jun 18 '20 at 15:28
  • @SonNguyen Sorry i forgot to mention but i tried and it didnt work as these resources are directly managed by operator so after my changes operator override it immediatly kubectl patch statefulset cluster1-pxc -p '{"spec": {"template": {"spec":{"containers":[{"name":"pxc","imagePullPolicy":"Never"}]}}}}' – ImranRazaKhan Jun 18 '20 at 15:40
  • My last two cents is could you somehow extract the config (like `get -o yaml`) and then start the statefulset manually. That maybe a workaround if you can't get the config into the software. – Son Nguyen Jun 18 '20 at 23:10

0 Answers0