kubernetes滚动更新不会创建新的pod

时间:2019-03-22 14:30:21

标签: kubernetes

以下是我的部署文件。我正在尝试使用kubernetes的滚动更新来调出新的pod并降低旧的pod。我收到一条成功消息,

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         

步骤1:

kubectl apply -f deployment.yaml        

Step2:我将图片名称更改为

bitnami/nginx:1.14.2

Step3:

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

我收到类似deployment "gql-deployment" successfully rolled out

的消息

但是pod名称保持不变。我错过了一步吗?

2 个答案:

答案 0 :(得分:0)

对于步骤2,您应该

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

正如您在下面的屏幕截图中看到的那样,旧容器已终止,并且图像为 1.14.2 的新容器已启动

推出历史记录也显示更新成功

enter image description here

答案 1 :(得分:-1)

部署与“ nginx”映像正常配合使用。我建议用不同的图像测试“ readinessProbe”。希望有帮助。