Files
oam/knowledge base/kubernetes/helm.md

3.5 KiB

Helm

Package manager for Kubernetes.

Table of contents

  1. TL;DR
  2. Start managing existing resources with a specific helm chart
  3. Plugins
  4. Further readings

TL;DR

# List installed plugins.
helm plugin list
helm plugin ls

# Install new plugins.
helm plugin add 'https://github.com/author/plugin'
helm plugin install 'path/to/plugin'

# Update installed plugins.
helm plugin update 'plugin_name'
helm plugin up 'plugin_name'

# Uninstall plugins.
helm plugin rm 'plugin_name'
helm plugin remove 'plugin_name'
helm plugin uninstall 'plugin_name'


# List added repositories.
helm repo list

# Add repositories.
helm repo add 'grafana' 'https://grafana.github.io/helm-charts'
helm repo add 'ingress-nginx' 'https://kubernetes.github.io/ingress-nginx'

# Update repositories.
helm repo update
helm repo update 'keda'

# Remove repositories.
helm repo remove 'prometheus'


# Search for specific charts
helm search hub --max-col-width '100' 'ingress-nginx'
helm search repo 'grafana'
helm search repo --versions 'grafana/grafana'

# Download and extract charts.
helm pull 'grafana/grafana'
helm pull 'ingress-nginx/ingress-nginx' --version '4.0.6' \
  --destination '/tmp' \
  --untar --untardir 'extracted/chart'

# Get the default values of specific charts.
helm inspect values 'gitlab/gitlab'


# Install releases
helm install 'my-gitlab' 'gitlab/gitlab'
helm upgrade --install 'my-gitlab' 'gitlab/gitlab'
helm install --atomic --values 'values.yaml' 'my-gitlab' 'gitlab/gitlab'
helm install --set 'value=key' 'my-gitlab' 'gitlab/gitlab'

# Install charts without adding their repository.
helm upgrade --install 'keda' 'keda' \
  --repo 'https://kedacore.github.io/charts' \
  --namespace 'keda' --create-namespace

# Upgrade deployed releases.
helm upgrade --install 'my-wordpress' 'wordpress'
helm upgrade --values 'values.yaml' 'my-wordpress' 'wordpress'
helm upgrade --namespace 'gitlab' --values 'values.yaml' 'gitlab gitlab/gitlab' --dry-run
helm upgrade --atomic --create-namespace --namespace 'gitlab' --timeout 0 --values 'values.yaml' 'gitlab' 'gitlab/gitlab' --debug

# Inspect deployed releases' manifests.
helm get manifest 'wordpress'

Start managing existing resources with a specific helm chart

Since helm 3.2 it's possible to import/adopt existing resources into a helm release.
To achieve this:

  1. create your helm release leaving out the needed existing resources

  2. add the following annotation and labels to the existing resources:

    annotations:
      meta.helm.sh/release-name: app-release-name
      meta.helm.sh/release-namespace: app-deployment-namespace-name
    labels:
      app.kubernetes.io/managed-by: Helm
    

    with app-release-name being the release name used to deploy the helm chart and app-deployment-namespace-name being the deployment namespace.

    kubectl annotate "$KIND" "$NAME" "meta.helm.sh/release-name=${RELEASE_NAME}"
    kubectl annotate "$KIND" "$NAME" "meta.helm.sh/release-namespace=$NAMESPACE"
    kubectl label "$KIND" "$NAME" "app.kubernetes.io/managed-by=Helm"
    
  3. now, add the existing resources' manifests to the chart

  4. execute a chart upgrade:

    helm upgrade 'app-release-name'
    

Plugins

TODO

Further readings