You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Helm is inconsistent about failed deployments #2437
This is basically a generalized version of the bug#2257, possibly other filed issues and a failure mode that I've encountered today.
It seems that helm does not care if for some unknown class of reasons a deployment fails. Helm will report the failure but then happily false-successfully re-deploy the same chart, without changing the actual state but registering a new state in a history config map (revision).
There are two ways to trigger helm's schizophrenia:
Helm detects wrong state when chart contains envFrom #2257
1a. Install a chart that contains a property that is yet unknown to helm, e.g. envFrom before helm v2.4.0: true success
1b. Upgrade the release with a change in its chart that may or may not be related to that property, thus triggering the patch code path: failure
1c. Upgrade the release again without any change: the cluster is in an undefined state and helm lies about it. :(
2a. Install a chart that is both valid and fully supported by helm. My case includes a ClusterRoleBinding: deployment is successful, obviously.
2b. Change the ClusterRoleBinding using an invalid {kind: ServiceAccount, subjects.name:}. Deployment fails as it should.
2c. Deploy the same chart again w/o any changes since 2b. This deployment falsely succeeds and helm is in the same schizophrenic state as in case 1.
IIUC, some variant of 2b. we see Helm/Tiller get out of sync with K8s actual state. It's not envFrom, and it's not silently immutable fields in Deployment or Daemonset. It has occurred in several different cases when the K8S API server rejecting a patches due to failed validations. Helm seems to barrel on assuming that the patch succeeded, and recording the desired state as actual.
After that, there were some other changes -- in this case I believe to the "image" and "env" of one of the containers -- that didn't occur, but were apparently recorded as being successful. Future upgrades after correcting the protocol to 'TCP' did not update the image and env contents to the new values.
I don't have a minimal test case put together yet, but I do have the full Tiller log and the "helm get" of the Tiller release configmaps from before and after the failure.
This occurred with Tiller v2.4.1, Helm client v2.3.1 on K8S 1.6.3.
Okay. Thanks. I'm currently looking into the following two options:
If a release fails, don't allow an upgrade without first doing a rollback to a known-good version
If a validation fails, see if we can avoid storing the new manifest (e.g. force a diff against the last known valid version). This one is harder than it sounds, and may just introduce another set of bugs.
And perhaps there are some other options that I haven't thought of.
Reacted by Robert Sanders, Kiichiro Okano and Frode Egeland
In our case, this issue mostly occurs during development. The errors happen, and then the developer re-upgrades the release (apparently) successfully after fixing the validation problem. Long after that original error, the disconnect between what the developer believes is running in the cluster and what is actually running continues, leading to a great deal of confusion.
Option #1 seems like an unambiguous, low-risk improvement. A degraded state that forces the operator to explicitly resolve it with some extraordinary means would prevent all that confusion.
It's too bad the K8S API doesn't have its own "dry run" mode for validation-only operations, or transactional batch mode.
We are also getting hit by something similar to this. Our helm upgrade fails for something like this:
Deployment.extensions "efritin-efritin-image-service-thrift" is invalid: spec.template.metadata.labels: Invalid value: {"app":"efritin-efritin","chart":"efritin-0.1.0-rc6","component":"image_service","release":"efritin","source":
"kviberg","stage":"production","tier":"thrift"}: `selector` does not match template `labels`
Running helm upgradeagain with the same chart and release "succeeds", but nothing changes on the K8s resources themselves. In our case all future upgrades are communicated incorrectly, so once the upgrade fails it seems that it cannot be correctly upgraded again.
This was discussed on the dev call at length this morning. We need to devise a repeatable case of this so that we can start writing test cases. If anyone has a minimal reproduction case, please point to it here.
See also #2341 - which is an approach I don't think will work because it will invert the problem (successful things will fail because a strategic merge will be run on the wrong version). But I could be wrong. :-)
@technosophos I confirm that the test chart illustrates the issue (thanks @rsanders). You are left with an innocent looking history that does not reveal revision 2 failed and the current release manifest (3) does not reflect the actual k8s manifest (1).
The only edge case this may introduce is when a user deploys a release that initially fails then tries to upgrade to fix it, but if a chart is in that state it should be removed and re-deployed.
That's not an edge case, though. It is an expected action path, especially in an environment where Helm is used in a CD pipeline, operated by non-k8s and non-helm experienced users (which is a point of having a CD). It is virtually impossible to explain this (again: to be expected) case of undefined and horribly misleading behavior to application developers.
Helm in my opinion must detect a failed state andfail to upgrade from it (unless Helm can fix the state properly). I hope I am not too annoying by repetition, but the main point I am trying to make is: This is not an edge case. It is a major pain point. It renders Helm as the weakest link in any CD chain.
Are you saying that the now merged fix removes and re-deploys a chart if (edge case) a release initially failed and then a user tries to fix it by deploying a new release?
helm version is 2.7.2 and kubectl version is 1.8.0. Cluster was minikube v0.23.0 (k8s 1.8.0) but the chart isn't public/easy to pair down. It's just a helm upgrade on a previously failed release (previous release timed out with --wait) (doesn't matter if there have been successful previously or not).
I'll see if i can come up with a simple reproduction, but might take some time as I'm switching back to 2.6.2 to work around this for now.
Activity
[-]Helm is schizophrenic about failed deployments[/-][+]Helm is inconsistent about failed deployments[/+]rsanders commentedon May 24, 2017
We are getting bitten by this several times a week.
technosophos commentedon May 24, 2017
By what, precisely?
rsanders commentedon May 24, 2017
IIUC, some variant of 2b. we see Helm/Tiller get out of sync with K8s actual state. It's not envFrom, and it's not silently immutable fields in Deployment or Daemonset. It has occurred in several different cases when the K8S API server rejecting a patches due to failed validations. Helm seems to barrel on assuming that the patch succeeded, and recording the desired state as actual.
For example, from the Tiller log:
After that, there were some other changes -- in this case I believe to the "image" and "env" of one of the containers -- that didn't occur, but were apparently recorded as being successful. Future upgrades after correcting the protocol to 'TCP' did not update the image and env contents to the new values.
I don't have a minimal test case put together yet, but I do have the full Tiller log and the "helm get" of the Tiller release configmaps from before and after the failure.
This occurred with Tiller v2.4.1, Helm client v2.3.1 on K8S 1.6.3.
rsanders commentedon May 24, 2017
Perhaps I should comment instead on #2257?
technosophos commentedon May 24, 2017
Okay. Thanks. I'm currently looking into the following two options:
And perhaps there are some other options that I haven't thought of.
rsanders commentedon May 25, 2017
In our case, this issue mostly occurs during development. The errors happen, and then the developer re-upgrades the release (apparently) successfully after fixing the validation problem. Long after that original error, the disconnect between what the developer believes is running in the cluster and what is actually running continues, leading to a great deal of confusion.
Option #1 seems like an unambiguous, low-risk improvement. A degraded state that forces the operator to explicitly resolve it with some extraordinary means would prevent all that confusion.
It's too bad the K8S API doesn't have its own "dry run" mode for validation-only operations, or transactional batch mode.
ahawkins commentedon May 25, 2017
We are also getting hit by something similar to this. Our
helm upgradefails for something like this:Running
helm upgradeagain with the same chart and release "succeeds", but nothing changes on the K8s resources themselves. In our case all future upgrades are communicated incorrectly, so once the upgrade fails it seems that it cannot be correctly upgraded again.technosophos commentedon May 25, 2017
This was discussed on the dev call at length this morning. We need to devise a repeatable case of this so that we can start writing test cases. If anyone has a minimal reproduction case, please point to it here.
/cc @adamreese @seh
See also #2341 - which is an approach I don't think will work because it will invert the problem (successful things will fail because a strategic merge will be run on the wrong version). But I could be wrong. :-)
rsanders commentedon May 26, 2017
@technosophos this seems to repeatably demonstrate the out-of-sync issue. https://github.com/rsanders/helm-2437-test-case
blakebarnett commentedon Aug 7, 2017
We see this very frequently also.
jascott1 commentedon Sep 12, 2017
@technosophos I confirm that the test chart illustrates the issue (thanks @rsanders). You are left with an innocent looking history that does not reveal revision 2 failed and the current release manifest (3) does not reflect the actual k8s manifest (1).
2 remaining items
blakebarnett commentedon Oct 31, 2017
Yeah I couldn't find it earlier, but it's here: #2341
There are various other issues and PRs that reference this problem also in different ways, here's a couple:
#2333
#2346
thomastaylor312 commentedon Nov 1, 2017
Thanks @blakebarnett!
fix(tiller): upgrade last deployed release
fix(tiller): upgrade last deployed release
fix(tiller): upgrade last deployed release
jwkohnen commentedon Nov 8, 2017
From #3097 (comment)
That's not an edge case, though. It is an expected action path, especially in an environment where Helm is used in a CD pipeline, operated by non-k8s and non-helm experienced users (which is a point of having a CD). It is virtually impossible to explain this (again: to be expected) case of undefined and horribly misleading behavior to application developers.
Helm in my opinion must detect a failed state and fail to upgrade from it (unless Helm can fix the state properly). I hope I am not too annoying by repetition, but the main point I am trying to make is: This is not an edge case. It is a major pain point. It renders Helm as the weakest link in any CD chain.
bacongobbler commentedon Nov 8, 2017
That is exactly what we are doing with this patch.
jwkohnen commentedon Nov 9, 2017
Are you saying that the now merged fix removes and re-deploys a chart if (edge case) a release initially failed and then a user tries to fix it by deploying a new release?
fix(tiller): upgrade last deployed release
chancez commentedon Nov 17, 2017
I am still hitting this issue with 2.7.2
bacongobbler commentedon Nov 17, 2017
@wjkohnen no.
@chancez can you provide a test case we can use to reproduce the issue?
A list of the usual suspects would be helpful to identify the root cause:
helm versionkubectl versionchancez commentedon Nov 20, 2017
helm version is 2.7.2 and kubectl version is 1.8.0. Cluster was minikube v0.23.0 (k8s 1.8.0) but the chart isn't public/easy to pair down. It's just a
helm upgradeon a previously failed release (previous release timed out with --wait) (doesn't matter if there have been successful previously or not).I'll see if i can come up with a simple reproduction, but might take some time as I'm switching back to 2.6.2 to work around this for now.