我正在尝试在Kubernetes中实施部署的滚动更新。我关注了许多文章,说停机时间为零,但是当我连续运行curl时。我的几个请求都失败了,然后又没有回复。以下是部署文件。
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myapp-deployment
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: my-image
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
我做的下一件事是
MinReadySeconds:120
这可以解决此问题,但它不是最佳解决方案,因为我们希望在下一个容器开始服务请求并杀死旧容器时立即切换到下一个容器。我有两个问题-
答案 0 :(得分:0)
尝试一下。这应该为您工作。尝试更新您的图片。
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myapp-deployment
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: nginx
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
为使您更好地理解,请检查此link