Kubernetes is not re-pulling an image with ImagePullPolicy: Always

4/26/2018

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
kubernetes

0 Answers