Helm and Kubernetes

Cloud Native: A Helm Chart For an SSH Server#

You’ve got some software that you want to deploy to Kubernetes. The first step is to create the Kuernetes manifests that implement the application. At minimum you’ll create YAML for:

  1. The workload resources (StatefulSet or Deployment)

  2. Storage (PersistentVolumeClaim)

  3. Connectivity (Service)

  4. Configuration (ConfigMap and Secret)

Depending on your application you might also have service accounts, pod autoscaling and many more. But these files are static files. What if you want to create a paramererized and reusable application definition? That’s the job of a Helm Chart.

At its heart Helm is a templating system that builds Kubernetes manifests from YAML templates so you can conveniently rename and parameterize applications. Helm charts have a repository system, like apt and yum, except it’s easier to add thrid-party repositories. Here’s how to add my repo:

$ helm repo add cloud-native-server https://mike-matera.github.io/cloud-native-server/
$ helm repo update

In order to use the cloud server you need to generate an SSH Certificate Authority Key. For more about SSH Certificates check this RedHat article. I will do a future blog post on the subject. Generate the SSH key like this:

$ ssh-keygen -t rsa -f ca_key -N ''

Now you can deploy your own server:

$ helm install myserver cloud-native-server/cloud-server \
    --set user=$USER \
    --set hostName=myhost \
    --set-file ssh.ca_key=./ca_key,ssh.ca_key_pub=./ca_key.pub

There are many more useful parameters and you have your choice of Linux distribution. As of right now I support Ubuntu 22.04, Fedora 36 and Arch Linux. I will be putting this chart into production next semester.