gpt4 book ai didi

kubernetes - Helm 错误 : release requires a rollback before it can be upgraded

转载 作者:行者123 更新时间:2023-12-04 00:53:52 26 4
gpt4 key购买 nike

在我的集群中,我使用 weave flux连同他们的flux-helm-operator 以gitops 的方式管理我的集群。

但是,当我在flux git存储库中对图表进行更改时,经常会遇到以下错误消息:

ts=2019-09-25T11:54:37.604506452Z caller=chartsync.go:328 component=chartsync
warning="unable to proceed with release"
resource=mychart:helmrelease/mychart release=mychart
err="release requires a rollback before it can be upgraded (FAILED)"

我不确定 helm 是什么意思,但无论如何,我不应该运行任何 helm 命令,因为发布是由流量管理的,所以我想知道在生产中处理这个错误的正确方法是什么

(除了删除版本并等待通量重新创建它)

一个解释清楚的答案将被非常接受,谢谢。

最佳答案

让我们深入了解 helm-operator 的代码

警告 unable to proceed with release出现在 GetUpgradableRelease 之后

    // GetUpgradableRelease returns a release if the current state of it
// allows an upgrade, a descriptive error if it is not allowed, or
// nil if the release does not exist.


它返回错误 release requires a rollback before it can be upgraded如果版本有 Status_FAILED状态(见 release.go#89)
UNHEALTHY状态块释放

flux开发人员 mentioned in #2265 ,没有办法滚动到 UNHEALTHY状态。

This is not a bug but I can see where your expectation is coming from.

Flux will only move healthy releases forward, one of the reasons for this is to ensure we do not end up in a loop of failure, the --force flag is thus not intended to be used to force the upgrade of an unhealthy resource (you should use the rollback feature for this) but was developed to make it possible to upgrade charts with e.g. backwards incompatible changes (changes on immutable fields for example, which require a resource to be removed first, see #1760).

Conclusion: the forceUpgrade is honoured, but can not be used to force the upgrade of a release in an UNHEALTHY state.



Rollback

正如作者推荐的,你应该使用 rollback 特征

From time to time a release made by the Helm operator may fail, it is possible to automate the rollback of a failed release by setting .spec.rollback.enable to true on the HelmRelease resource.

Note: a successful rollback of a Helm chart containing a StatefulSet resource is known to be tricky, and one of the main reasons automated rollbacks are not enabled by default for all HelmReleases. Verify a manual rollback of your Helm chart does not cause any problems before enabling it.

When enabled, the Helm operator will detect a faulty upgrade and perform a rollback, it will not attempt a new upgrade unless it detects a change in values and/or the chart.


apiVersion: flux.weave.works/v1beta1
kind: HelmRelease
# metadata: ...
spec:
# Listed values are the defaults.
rollback:
# If set, will perform rollbacks for this release.
enable: false
# If set, will force resource update through delete/recreate if
# needed.
force: false
# Prevent hooks from running during rollback.
disableHooks: false
# Time in seconds to wait for any individual Kubernetes operation.
timeout: 300
# If set, will wait until all Pods, PVCs, Services, and minimum
# number of Pods of a Deployment are in a ready state before
# marking the release as successful. It will wait for as long
# as the set timeout.
wait: false

关于kubernetes - Helm 错误 : release requires a rollback before it can be upgraded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58097994/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com