Git Product home page Git Product logo

k8s-tiller-history-cleanup's Introduction

k8s-tiller-history-cleanup


WARNING: This is about helm 2, in the old days... (2019) Please move to helm 3+, and do not use this old cleanup anymore ;-) Repo just kept for historic purposes.

Kubernetes Tiller/Helm Release History Cleanup, a script to cleanup old helm tiller history config maps.

See also: https://www.kaper.com/cloud/k8s-tiller-helm-history-cleanup/

This can be handy if you forgot to set TILLER_HISTORY_MAX on your tiller deployment, and added it later on. Or... if you remove components using kubectl delete instead of using helm delete (we do remove some namespaces automatically, which leaves unused tiller configmaps in the system).

In the script, change the two variables below to match your setup.

TILLER_NAMESPACE=kube-system
TILLER_HISTORY_MAX=5

In our cluster, I used the following command to alter the history size:

kubectl edit deploy -n kube-system tiller-deploy

This is the env fragment:

      - env:
        - name: TILLER_NAMESPACE
          value: kube-system
        - name: TILLER_HISTORY_MAX
          value: "5"

The script can be called using: ./tiller-cleanup.sh with a single parameter of -f or -n:

Usage: ./tiller-cleanup.sh [-f | -n]
Use -n for a dry-run to show what would be deleted
Use -f to execute a run with actual deletes

Note: the script also queries the system for ALL components which are labeled with heritage=Tiller, to find if there is an active helm deploy for a certain release. If not found, the helm history will be removed.

Please be carefull, and first execute a dry-run to see if the script will remove the right data for your setup.

Note: this script needs a working kubectl command, with active Kubernetes cluster context. It does not need helm.

For reference, the versions of helm/k8s on which we use this:

$ helm version
Client: &version.Version{SemVer:"v2.8.2", GitCommit:"a80231648a1473929271764b920a8e346f6de844", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.8.2", GitCommit:"a80231648a1473929271764b920a8e346f6de844", GitTreeState:"clean"}

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.5", GitCommit:"cce11c6a185279d037023e02ac5249e14daa22bf", GitTreeState:"clean", BuildDate:"2017-12-07T16:16:03Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1+coreos.0", GitCommit:"59359d9fdce74738ac9a672d2f31e9a346c5cece", GitTreeState:"clean", BuildDate:"2017-10-12T21:53:13Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

28/5/2019, Thijs Kaper.

Open Issue:

  • #2 - a helm chart containing only some configmap or secret loses it's history.

24/6/2020.

k8s-tiller-history-cleanup's People

Contributors

atkaper avatar jc36 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

k8s-tiller-history-cleanup's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.