[英]kubernetes rolling updates not creating new pods
Below is my deployment file. 以下是我的部署文件。 I am trying to bring up new pod and bring down old pod using rolling update of kubernetes. 我正在尝试使用kubernetes的滚动更新来调出新的pod并降低旧的pod。 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: 第1步:
kubectl apply -f deployment.yaml
Step2: I change the image name to 步骤2:我将图片名称更改为
bitnami/nginx:1.14.2
Step3: 第三步:
kubectl rollout status deployment.v1beta1.extensions/gql-deployment
I get message like deployment "gql-deployment" successfully rolled out
我收到类似deployment "gql-deployment" successfully rolled out
消息
But pod names remains same. 但是pod名称保持不变。 Am i missing some step? 我错过了一些步骤吗?
For Step 2 you should do 对于步骤2,您应该
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 正如您在下面的屏幕截图中看到的那样,旧容器已终止,并且已启动图像1.14.2的新容器
A rollout history also shows a successful update 推出历史记录也显示更新成功
Deployment is working properly with "nginx" images. 部署可与“ nginx”映像一起正常使用。 I would suggest to test "readinessProbe" with different images. 我建议用不同的图像测试“ readinessProbe”。 Hope this help. 希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.