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
I have 16 clusters running with the same config and only the older clusters are affected at the moment, suggesting that the problem is related to #4821. However, of the older clusters, one has 564 releases, and ticks along happily with around 80Mb memory, which jumps to 700Mb when responding to helm list, whereas the other has 310 releases, ticks along at around 70Mb then jumps to 670Mb when responding to helm list.
Every consecutive call to helm list it uses a bit more memory until, as described by @primalmotion, things start to break. The same thing happens with installs and upgrades, so you can imagine, with a busy CI/CD pipeline, things start to fall over pretty quickly.
We are seeing performance degradation over time on older clusters. Every execution of helm upgrade or helm list is churning the API servers and causes 1-2 GB additional RAM use. Chaining commands just keeps allocating more RAM. Waiting a decent period of time allows some RAM to be released.
This command on one cluster took a while and there are 3.5k ConfigMaps. Each is 1MB max, so up to 3.5GB data. The most frequently deployed application has >1000 revisions.
$ kubectl -n kube-system get cm --no-headers -l OWNER=TILLER | wc -l
3417
How can we prune ConfigMaps for older revisions of deployments with out deleting deployed, in-production applications?
@mortent's comment here in #4821 seems to be fairly compelling. Last I checked the filtering was indeed being done on Tiller's side rather than filtering out on the apiserver side. If someone wants to take a look at how we could improve the filtering from the apiserver, that'd be great.
For the lazy:
Based on just a quick look at the code, it seems like pretty much all filtering, including the size limit, is enforced in Tiller and not in the ApiServer/etcd. So you could potentially be pulling in a large number of ConfigMaps from the ApiServer.
It sounds like redeploying with something reasonable for --history-max is our best option to stabilize these clusters. Then there will not be so much to filter every time.
You might also want to check the size of the charts since they are stored in the configmaps. Anything where the packaged chart .tgz is greater than 100kb is suspect, check .helmignore. Here's a snippet to check the size of the tiller configmaps.
kubectl -n tiller-namespace get cm -lOWNER=TILLER -oname | xargs -n1 -I CM sh -c 'echo "CM" $(kubectl -n tiller-namespace get CM -ojsonpath={.data.release} | wc -c)'
Thanks @asherlporetz, I checked the state backups, and the total size all the ~3,500 ConfigMaps is 70MB, so each release ConfigMap averages around 20Kb (full text, including release data).
While the raw data is ~70MB for ~3,500 objects, the API Server allocates over 900MB of RAM to respond to all the tiller requests during a single helm list involving these objects, and tiller allocates a further 400MB RAM to process the responses. It's all not very scaleable.
Options like helm list --max 1 or helm list <release-name> don't seem to reduce the impact, Proabably because as @bacongobbler pointed out, all the filtering is done in tiller. It appears to fetch everything, every time. And multiple helm operations close together in time compound until something breaks, as @paolomainardi experienced.
Given this experience a strictly limited --max-history is essential. I don't think 'unlimited' is a sensible --max-history default.
As I bring down the object counts in my testing I am seeing a pretty linear relationship; For each average 20Kb ConfigMap in the cluster, tiller reads it in and allocates ~110Kb of RAM, when doing any operation like a helm list or helm upgrade. A helm upgrade needs about and extra 40MB RAM over a helm list, which seems a very reasonable uplift for computing an actual deployment manifest.
So with a cluster with ~200 charts deployed, each on average 20Kb, and --max-history=50 you appear to need about 1GB RAM for a single tiller operation. You possibly need that amount again for each concurrent tiller operation, as multiple operations don't seem to share any retrieved release data, they fetch it all again. Even with --max-history in place, tiller resourcing and API server load can be significant.
Removing tiller won't cause it to lose state. The only way it'll lose state is if you remove the ConfigMaps tiller stores in kube-system yourself. You can safely call helm reset --force && helm init without losing any cluster state as it only removes tiller, but not the releases.
As a mini demonstration:
><> helm install stable/nginx-ingress
><> helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
wobbly-bee 1 Thu Feb 14 14:50:42 2019 DEPLOYED nginx-ingress-1.3.0 0.22.0 default
><> helm reset --force
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.
><> helm init
><> helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
wobbly-bee 1 Thu Feb 14 14:50:42 2019 DEPLOYED nginx-ingress-1.3.0 0.22.0 default
Either that or just kubectl -n kube-system edit deploy tiller-deploy and change the value of TILLER_HISTORY_MAX. Either way ends up being the same.
Reacted by Ray Walker, Pin-Sho Feng, Granville Schmidt, Pablo Castellano, Kevin, umiyosh, Javier Juarez, Manuel Ohlendorf, Max Lobur, Leon Card and 4 more
Yes @27Bslash6 you can change the --history-max for tiller on an active cluster. Once changed the next deployment to each release will purge the history.
No, I still have a lot of pruning to do on clusters, given you need re-deploy every release to trigger the clean-up function. I'm locking new clusters to just --max-history 10. I want to try to keep the number of ConfigMaps retrieved from the API Server per helm operation under 1,000 objects. And that should also keep tiller to ~0.25GB RAM per concurrent operation. I'm patching in resource settings for tiller so it can't undermine node stability.
We've pruned down to under 1,000 objects and it has made a big difference. Tiller memory appears mainly driven by the number of ConfigMaps/Secrets for a release; Per deployment RAM use has dropped from ~500MB+ to ~30-40MB, even less than I expected. And API server RAM use per deployment has dropped from ~1GB to ~500MB.
We don't have use for the release history, as the deployment history is all in the CI/CD system anyway. So we'll probably configure --max-history to a minimum, maybe 2-3 revisions. That should eliminate the scaling problem entirely.
I'm very curious to see if this has been improved in Helm 3. With Tiller's removal, we took the time to refactor a huge chunk of the underlying SDK supporting helm ls and how Helm interacts with the API server.
Helm 3, all list operations are still horribly slow with 40+ releases.
We have approximately 5 versions of each release and were forced to re-write our CD process from helm ls to helm get ... and lookups with kubectl get secrets .... -l name=xxx,status=..., etc.
Does anyone have a test case to help reproduce this issue? There are many reports of this behaviour, but I don't see a way to reproduce the issue ourselves. It's important we have a base case to test against so we can confirm if a fix will resolve this issue. Thanks!
+1
helm 3 ,release 200+, and history default 10
helm ls -->50s
similar performance issue #8008, and we find that kubectl get secret -l owner=helm costs too much time if there are 1000+ release secrets, it's probably etcd's or apisever's issue.
With helm 2 we could work around most of the memory and speed problems by setting a Tiller history max value and clamping that to 2 or 3 per deployment. With helm 3 is there any similar environment setting we can use, like HELM_HISTORY_MAX or similar? There is the --history-max command line argument, but it seems like you have to reliably add it to absolutely every invocation or it will default to 10, potentially keeping more that you wanted, or worse, deleting some history you wanted to keep.
As this issue is related to "tiller consuming an insane amount of memory", and tiller no longer exists for Helm 3, I'm going ahead and closing this.
For those reporting performance issues with helm list for Helm 3, please follow up in #8008. A test case to reproduce the issue (as in, a script to create a cluster, create 1000+ releases, and observe the time of helm list) would be helpful as well so we can try to reproduce the same issue. Thanks.
Activity
primalmotion commentedon Aug 28, 2018
the same happened with helm 2.9.1
jascott1 commentedon Aug 28, 2018
@bacongobbler I recall something like this before with some handles being kept open. Ring any bells with you?
YenTheFirst commentedon Sep 18, 2018
We've been seeing a similar issue with
helm history.specifically,
while true; do helm history RELEASE_NAME >/dev/null & sleep 1; doneseems to easily reproduce the following:chaholl commentedon Feb 8, 2019
I'm seeing the same problem in an AKS cluster.
I have 16 clusters running with the same config and only the older clusters are affected at the moment, suggesting that the problem is related to #4821. However, of the older clusters, one has 564 releases, and ticks along happily with around 80Mb memory, which jumps to 700Mb when responding to
helm list, whereas the other has 310 releases, ticks along at around 70Mb then jumps to 670Mb when responding tohelm list.Every consecutive call to
helm listit uses a bit more memory until, as described by @primalmotion, things start to break. The same thing happens with installs and upgrades, so you can imagine, with a busy CI/CD pipeline, things start to fall over pretty quickly.whereisaaron commentedon Feb 13, 2019
We are seeing performance degradation over time on older clusters. Every execution of
helm upgradeorhelm listis churning the API servers and causes 1-2 GB additional RAM use. Chaining commands just keeps allocating more RAM. Waiting a decent period of time allows some RAM to be released.This command on one cluster took a while and there are 3.5k ConfigMaps. Each is 1MB max, so up to 3.5GB data. The most frequently deployed application has >1000 revisions.
How can we prune ConfigMaps for older revisions of deployments with out deleting deployed, in-production applications?
bacongobbler commentedon Feb 13, 2019
@mortent's comment here in #4821 seems to be fairly compelling. Last I checked the filtering was indeed being done on Tiller's side rather than filtering out on the apiserver side. If someone wants to take a look at how we could improve the filtering from the apiserver, that'd be great.
For the lazy:
whereisaaron commentedon Feb 13, 2019
It sounds like redeploying with something reasonable for
--history-maxis our best option to stabilize these clusters. Then there will not be so much to filter every time.asherlporetz commentedon Feb 13, 2019
You might also want to check the size of the charts since they are stored in the configmaps. Anything where the packaged chart .tgz is greater than 100kb is suspect, check
.helmignore. Here's a snippet to check the size of the tiller configmaps.whereisaaron commentedon Feb 14, 2019
Thanks @asherlporetz, I checked the state backups, and the total size all the ~3,500 ConfigMaps is 70MB, so each release ConfigMap averages around 20Kb (full text, including release data).
While the raw data is ~70MB for ~3,500 objects, the API Server allocates over 900MB of RAM to respond to all the
tillerrequests during a singlehelm listinvolving these objects, andtillerallocates a further 400MB RAM to process the responses. It's all not very scaleable.Options like
helm list --max 1orhelm list <release-name>don't seem to reduce the impact, Proabably because as @bacongobbler pointed out, all the filtering is done intiller. It appears to fetch everything, every time. And multiplehelmoperations close together in time compound until something breaks, as @paolomainardi experienced.Given this experience a strictly limited
--max-historyis essential. I don't think 'unlimited' is a sensible--max-historydefault.whereisaaron commentedon Feb 14, 2019
As I bring down the object counts in my testing I am seeing a pretty linear relationship; For each average 20Kb ConfigMap in the cluster,
tillerreads it in and allocates ~110Kb of RAM, when doing any operation like ahelm listorhelm upgrade. Ahelm upgradeneeds about and extra 40MB RAM over ahelm list, which seems a very reasonable uplift for computing an actual deployment manifest.So with a cluster with ~200 charts deployed, each on average 20Kb, and
--max-history=50you appear to need about 1GB RAM for a singletilleroperation. You possibly need that amount again for each concurrenttilleroperation, as multiple operations don't seem to share any retrieved release data, they fetch it all again. Even with--max-historyin place,tillerresourcing and API server load can be significant.27Bslash6 commentedon Feb 14, 2019
Is there a quick workaround for this? I see in #3414 that setting
--history-maxon an already initialised cluster has no effect.Is there any convenient way to reduce max history size on a running cluster and not lose the entire current tiller state?
bacongobbler commentedon Feb 14, 2019
Removing tiller won't cause it to lose state. The only way it'll lose state is if you remove the ConfigMaps tiller stores in kube-system yourself. You can safely call
helm reset --force && helm initwithout losing any cluster state as it only removes tiller, but not the releases.As a mini demonstration:
Either that or just
kubectl -n kube-system edit deploy tiller-deployand change the value of TILLER_HISTORY_MAX. Either way ends up being the same.whereisaaron commentedon Feb 14, 2019
Yes @27Bslash6 you can change the
--history-maxfortilleron an active cluster. Once changed the next deployment to each release will purge the history.2 remaining items
whereisaaron commentedon Feb 15, 2019
No, I still have a lot of pruning to do on clusters, given you need re-deploy every release to trigger the clean-up function. I'm locking new clusters to just
--max-history 10. I want to try to keep the number of ConfigMaps retrieved from the API Server perhelmoperation under 1,000 objects. And that should also keeptillerto ~0.25GB RAM per concurrent operation. I'm patching inresourcesettings fortillerso it can't undermine node stability.whereisaaron commentedon Feb 28, 2019
We've pruned down to under 1,000 objects and it has made a big difference. Tiller memory appears mainly driven by the number of ConfigMaps/Secrets for a release; Per deployment RAM use has dropped from ~500MB+ to ~30-40MB, even less than I expected. And API server RAM use per deployment has dropped from ~1GB to ~500MB.
We don't have use for the release history, as the deployment history is all in the CI/CD system anyway. So we'll probably configure
--max-historyto a minimum, maybe 2-3 revisions. That should eliminate the scaling problem entirely.max-lobur commentedon Oct 11, 2019
Same issue here, been able to get 20seconds of
helm lsat best :(Tiller memory footprint decreased from 160 to 60mb, however
helm lstime decreased only by 5 seconds and now its 20s :(Any further ideas appreciated.
bacongobbler commentedon Oct 12, 2019
I'm very curious to see if this has been improved in Helm 3. With Tiller's removal, we took the time to refactor a huge chunk of the underlying SDK supporting
helm lsand how Helm interacts with the API server.virtuman commentedon Feb 12, 2020
Helm 3, all list operations are still horribly slow with 40+ releases.
We have approximately 5 versions of each release and were forced to re-write our CD process from
helm lstohelm get ...and lookups withkubectl get secrets .... -l name=xxx,status=..., etc.rvgud commentedon May 10, 2020
This may help https://medium.com/@ravindrashekhawat5876/helm-tiller-timeout-issue-be5faed6ecea
bacongobbler commentedon May 14, 2020
Does anyone have a test case to help reproduce this issue? There are many reports of this behaviour, but I don't see a way to reproduce the issue ourselves. It's important we have a base case to test against so we can confirm if a fix will resolve this issue. Thanks!
itaimalek commentedon May 17, 2020
@bacongobbler
yes I do. helm 2 though.
bacongobbler commentedon May 17, 2020
That's fine. Please share
clhlc commentedon May 26, 2020
+1
helm 3 ,release 200+, and history default 10
helm ls -->50s
liuming-dev commentedon May 26, 2020
similar performance issue #8008, and we find that
kubectl get secret -l owner=helmcosts too much time if there are 1000+ release secrets, it's probably etcd's or apisever's issue.whereisaaron commentedon Jun 27, 2020
With helm 2 we could work around most of the memory and speed problems by setting a Tiller history max value and clamping that to 2 or 3 per deployment. With helm 3 is there any similar environment setting we can use, like
HELM_HISTORY_MAXor similar? There is the--history-maxcommand line argument, but it seems like you have to reliably add it to absolutely every invocation or it will default to 10, potentially keeping more that you wanted, or worse, deleting some history you wanted to keep.hickeyma commentedon Jun 29, 2020
@whereisaaron This is a good point that you raise. I have opened #8367 for this.
bacongobbler commentedon Aug 14, 2020
We are no longer accepting bug fixes for Helm 2. See https://helm.sh/blog/helm-v2-deprecation-timeline/ for more details.
As this issue is related to "tiller consuming an insane amount of memory", and tiller no longer exists for Helm 3, I'm going ahead and closing this.
For those reporting performance issues with
helm listfor Helm 3, please follow up in #8008. A test case to reproduce the issue (as in, a script to create a cluster, create 1000+ releases, and observe the time ofhelm list) would be helpful as well so we can try to reproduce the same issue. Thanks.