Skip to content

Instantly share code, notes, and snippets.

@kimschles
Last active December 19, 2019 04:20
Show Gist options
  • Select an option

  • Save kimschles/9bf660a27778dcda542754f70b175831 to your computer and use it in GitHub Desktop.

Select an option

Save kimschles/9bf660a27778dcda542754f70b175831 to your computer and use it in GitHub Desktop.
Intro to Helm

Create a ConfigMap with Helm

Create a local chart

  • helm create first-chart
  • Change into the first-chart directory and look around
  • Delete the templates directory

Add a ConfigMap

  • (re)Make a templates directory and change into the directory
  • Create a configmap.yaml file
  • Copy and paste the ConfigMap below:
apiVersion: v1
kind: ConfigMap
metadata:
  name: first-chart-configmap
data:
  port: "8080"

Deploy the ConfigMap via Helm

  • helm install .
  • See your helm chart with helm ls
  • See all ConfigMaps with kubectl get cm
  • See your ConfigMap data with kubectl describe cm first-chart-configmap
  • Delete the helm chart with helm delete <helm_generated_name_of_chart>

Dynamically Render the Name of the ConfigMap with Helm Templating

  • Edit your ConfigMap to generate the name dynamically with a Helm template directive
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  port: "8080"
  • helm install .
  • See your helm chart with helm ls
  • See all configmaps with kubectl get cm
  • Delete the helm chart with helm delete <helm_generated_name_of_chart>

Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment