kubernetes rolling updates not creating new pods

3/22/2019

Below is my deployment file. I am trying to bring up new pod and bring down old pod using rolling update of kubernetes. I get a success message as

deployment "gql-deployment" successfully rolled out but pod remains as it is.


---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: gql-deployment
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: gql-pod
    spec:
      containers:
      - name: gql-cont
        image: bitnami/nginx:1.14
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: 512Mi
            cpu: 500m        
          limits:
            memory: 512Mi
            cpu: 500m
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 10
          periodSeconds: 5
          successThreshold: 1         

step1:

kubectl apply -f deployment.yaml        

Step2: I change the image name to

bitnami/nginx:1.14.2

Step3:

kubectl rollout status deployment.v1beta1.extensions/gql-deployment

I get message like deployment "gql-deployment" successfully rolled out

But pod names remains same. Am i missing some step?

-- Hacker
kubernetes

2 Answers

3/26/2019

For Step 2 you should do

kubectl set image deployment.v1.apps/gql-deployment gql-cont=nginx:1.14.2 --record=true

As you can see on the screenshot below old pod is terminated and new one with image 1.14.2 has been started

A rollout history also shows a successful update

enter image description here

-- A_Suh
Source: StackOverflow

3/22/2019

Deployment is working properly with "nginx" images. I would suggest to test "readinessProbe" with different images. Hope this help.

-- Hanx
Source: StackOverflow