CrashLoopBackOff时如何自动停止滚动更新? [英] How to automatically stop rolling update when CrashLoopBackOff?

查看:77
本文介绍了CrashLoopBackOff时如何自动停止滚动更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Kubernetes Engine,并故意在代码中输入错误.我希望滚动更新在发现状态为CrashLoopBackOff时会停止,但是不是.

I use Google Kubernetes Engine and I intentionally put an error in the code. I was hoping the rolling update will stop when it discovers the status is CrashLoopBackOff, but it wasn't.

他们说,在页面中.

Deployment控制器将自动停止错误的推出,并且 将停止按比例扩大新的ReplicaSet.这取决于 您拥有的rollingUpdate参数(特别是maxUnavailable) 指定.

The Deployment controller will stop the bad rollout automatically, and will stop scaling up the new ReplicaSet. This depends on the rollingUpdate parameters (maxUnavailable specifically) that you have specified.

但是这没有发生,仅当状态为ImagePullBackOff时?

But it's not happening, is it only if the status ImagePullBackOff?

下面是我的配置.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: volume-service
  labels:
    group: volume
    tier: service
spec:
  replicas: 4
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 2
      maxSurge: 2
  template:
    metadata:
      labels:
        group: volume
        tier: service
    spec:
      containers:
      - name: volume-service
        image: gcr.io/example/volume-service:latest

P.S.我已经阅读了活跃性/就绪性探针,但是我认为它不能停止滚动更新吗?还是它?

P.S. I already read liveness/readiness probes, but I don't think it can stop a rolling update? or is it?

推荐答案

原来,我只需要设置minReadySeconds,当新的副本集的状态为CrashLoopBackOff或类似Exited with status code 1时,它将停止滚动更新.因此,现在旧的copysetSet仍然可用并且未更新.

Turns out I just need to set minReadySeconds and it stops the rolling update when the new replicaSet has status CrashLoopBackOff or something like Exited with status code 1. So now the old replicaSet still available and not updated.

这是新的配置.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: volume-service
  labels:
    group: volume
    tier: service
spec:
  replicas: 4
  minReadySeconds: 60
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 2
      maxSurge: 2
  template:
    metadata:
      labels:
        group: volume
        tier: service
    spec:
      containers:
      - name: volume-service
        image: gcr.io/example/volume-service:latest

谢谢大家的帮助!

这篇关于CrashLoopBackOff时如何自动停止滚动更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆