0

I have an image of an App that returns "Hello World" upon calling. I have created an image of it with a tag equal to v1.

The image is running by Kubernetes and I have set the ImagePullPolicy to Always.

My expectation is that if I change the "Hello World" text to "Hello World Something!" and re-create the image in docker registry with the same tag name (v1), then I can see "Hello World Something!" when calling the app, after executing :

kubectl apply -f kubernetesConfig.yml

However, it doesn't work, and I still see "Hello World", unless I change the tag name to "v2", OR delete the pod.

Is my understanding about the purpose of ImagePullPolicy correct? if ImagePullPolicy does not force Kubernetes to re-pull an image, then how else can I achieve this?

Here is how my kubernetes config file looks like:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: testdeployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - image:  url/HelloWorld:v1
        imagePullPolicy: Always
        name: microservice
        ports:
        - containerPort: 3000
      imagePullSecrets:
      - name: regcred
Benjamin
  • 3,499
  • 8
  • 44
  • 77
  • Can you please provide an example of how you set the policy? – iocanel Apr 26 '18 at 07:12
  • @iocanel, I have updated my question. – Benjamin Apr 26 '18 at 07:20
  • First of all if there is no change in the deployment manifest, kubernetes will not apply anything new. In your case you just need to scale your deployment to zero and then scale it back to 1 or 2 depending on your number of replicas. – Bal Chua May 12 '18 at 23:32
  • 1
    `kubectl rollout restart deployment/` for anyone else landing here from a search – Ian Mercer Dec 19 '20 at 21:06

0 Answers0