Creating a Helm Chart

1.5 hours
  • 3 Learning Objectives

About this Hands-on Lab

For the last six months, the Acme Anvil Corporation has been migrating some of their bare metal infrastructure to Docker containers. A schism has developed between the members of your team on whether to use Docker Swarm or Kubernetes. To settle the dispute, your manager has decided to create a series of challenges. You have been tasked with using Helm charts to create an application using the `httpd` image. The service should be publicly accessible using NodePort.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Helm

Use curl to create a local copy of the Helm install script:

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > /tmp/get_helm.sh

Use chmod to modify access permissions for the install script:

chmod 700 /tmp/get_helm.sh

Set the version to v2.8.2:

DESIRED_VERSION=v2.8.2 /tmp/get_helm.sh

Ensure Helm uses the correct stable chart repo (the default one used by Helm has been decommissioned):

helm init --stable-repo-url https://charts.helm.sh/stable

Initialize Helm:

helm init --wait
Create a Helm Chart

Create the charts directory and change your working directory to charts:

mkdir charts
cd charts

Create the chart for httpd:

helm create httpd

Edit httpd/values.yaml:

replicaCount: 1

image:
  repository: httpd
  tag: latest
  pullPolicy: IfNotPresent

service:
  type: NodePort
  port: 80

ingress:
  enabled: false
  annotations: {}
  path: /
  hosts:
    - chart-example.local
  tls: []

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}
Create Your Application Using Helm

Create your application:

helm install --name my-httpd ./httpd/

Additional Resources

You are tasked with creating a Helm chart that will be used to create an httpd application.

  1. Install Helm and set the version to v2.8.2.
  2. Ensure Helm uses the correct stable chart repo.
  3. Initialize Helm using the wait flag.
  4. Give Helm the permissions it needs to work with Kubernetes:
    kubectl --namespace=kube-system create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
  5. Create a directory called charts where you will create your Helm chart.
  6. Navigate to the charts directory and create a chart called httpd.
  7. Edit the values.yaml file.
  8. Under images, change the repository to use the httpd image.
  9. Make sure that tag is set to latest.
  10. Under services, change type to NodePort.
  11. Install the chart you created by running the install command.
  12. Name the chart my-httpd.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?