Kubernetes Deployment 并行重启Pod

Kubernetes Deployment 并行重启Pod

参考:https://*.com/questions/59050709/how-to-rollout-restart-deployment-through-the-api

kubernetes 1.5 之后可以使用

kubectl rollout restart deployment my-deployment

API 可以调用 PATCH

参数:

apiVersion: apps/v1
kind: Deployment
spec:
  strategy:
    rollingUpdate:
      maxSurge: 并行数
  template:
    metadata:
      annotations: #增加restartedAt 加现在时间,可以立刻重启
        kubectl.kubernetes.io/restartedAt: '2021-01-01T15:04:05Z07:00'