Skip to content

Instantly share code, notes, and snippets.

@cywf
Created February 25, 2023 12:19
Show Gist options
  • Save cywf/fde8fec269d5c94059061ef210a00500 to your computer and use it in GitHub Desktop.
Save cywf/fde8fec269d5c94059061ef210a00500 to your computer and use it in GitHub Desktop.

Helm Charts - a practical guide by South Park Elementarys` favorite school counselor Mr. Mackey

alt text

Oh, okay there mmmkay, so you wanna learn about Helm charts, huh? Well, that's just great, mmmkay! Helm charts are a tool used to manage Kubernetes applications, and they're just super useful, mmmkay?

So, as I said before, Helm is a package manager for Kubernetes, mmmkay? And a Helm chart is a collection of files that describes a set of Kubernetes resources, like deployments, services, and config maps, mmmkay? Let's walk through how to create and deploy a simple Helm chart, mmmkay?

First, let's create a new Helm chart for a simple web application, mmmkay? Open up your terminal and type the following commands, mmmkay:

helm create mywebapp

This command creates a new directory called mywebapp with the basic files needed for a Helm chart, mmmkay?

Next, let's edit the values.yaml file to configure our application, mmmkay? This file contains the default values for your chart, and you can override them when you install your chart, mmmkay? For our simple web app, we'll just set the port to 8080, mmmkay? Open up mywebapp/values.yaml and make the following changes, mmmkay:

# Default values for mywebapp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
  repository: nginx
  tag: stable
  pullPolicy: IfNotPresent

service:
  type: ClusterIP
  port: 8080

ingress:
  enabled: false
  annotations: {}
  paths: []
  hosts:
    - chart-example.local

This creates a new Kubernetes deployment with the name mywebapp, using the nginx image, mmmkay? The replicaCount is set to 1, as we specified in values.yaml, mmmkay? And the container will listen on the port we specified in values.yaml, which is 8080, mmmkay?

Finally, let's create a new Kubernetes service for our web application, mmmkay? Open up mywebapp/templates/service.yaml and replace the contents with the following code, mmmkay:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "mywebapp.fullname" . }}
  labels:
    app: {{ include "mywebapp.name

In conclusion, Helm charts make it easy to deploy and manage applications on Kubernetes, mmmkay? With just a few files and some simple commands, you can create a package that includes all the Kubernetes resources needed to run your application, mmmkay? And by using Helm, you can easily install, upgrade, and rollback your application with just a few commands, mmmkay? So, give it a try and see how easy it is to deploy your own applications using Helm charts, mmmkay?

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