Making Kubernetes applications easy with Helm
Easily install complex applications with Helm the Kubernetes package manager.
Helm
Helm helps you manage Kubernetes applications
source: helm.sh
Helm is an application manager for the Kubernetes. It helps organize, integrate, deploy, and maintain complex applications on your Kubernetes cluster.
Helm chart
A helm chart is a collection of YAML files that define the installation, running, upgrade, and deletion behavior of a given application. A help chart also helps with integration of external dependencies. For example, if your application requires a database to operate, then you can add a database chart as a dependency to your own chart. Once your application is deployed, the dependent program will also be deployed and integrated with your application as you've defined it.
Helm Hub
Like other applications managers, Helm has a Hub of publicly available charts of popular applications. This Hub is a single place to explore and find charts. The owners of the charts may have their own repository which we will add to our helm installation and then use. This keeps the Helm ecosystem decentralized and scalable. It makes installing, and configuring the application very simple and efficient.
All the charts will be installing in this post are going to be from Helm Hub. In a future post, we will be creating our own Helm chart.
Helm Setup
Setting up Helm is very simple, assuming that you have a cluster setup already. For setting up your own cluster on AWS take a look at my previous post. Setting up on other cloud providers is just as easy and using pre-built solutions such as EKS, GKE, or DigitalOcean K8s.
Binary setup
I will be setting up Helm 3.x.x on Fedora 32 for this post. The main advantage of Helm 3.0 is that there is no cluster side component. Prior to version 3.0 Helm required the Tiller which was an application running in the your Kubernetes cluster for managing applications.
- Download the latest 3.x.x release from the Helm release page
a. Download for your platform, I'm downloading the Linux amd64 version - Extract and move the downloaded binary to a location that is in your PATH
- (Optional) Run
helm completion bash > helm
to generate a completion file for bash - (Optional) Move the completion file to a location where it can be automatically loaded into the shell
a. For Fedora I moved it to/etc/bash_completion.d/
and then started another terminal for a fresh shell
Assuming you have a cluster setup and .kube/config
file in place, your Helm setup is finished.
Installing Applications
1. Kubernetes Dashboard w/ Metrics Server
To install the dashboard we must first install the k8s-dashboard repo.
helm repo add k8s-dashboard https://kubernetes.github.io/dashboard
Then we must run update
command to download the latest repo data.
helm repo update
Now we can install the Dashboard application. Here we simply enable the metrics scraper and server, as well as the read only role to view our data in the dashboard.
helm upgrade kubernetes-dashboard k8s-dashboard/kubernetes-dashboard --set='metricsScraper.enabled=true,metrics-server.enabled=true,rbac.clusterReadOnlyRole=true'
Now run the the following commands to view the dashboard
export POD_NAME=$(kubectl get pods -n default -l "app.kubernetes.io/name=kubernetes-dashboard,app.kubernetes.io/instance=kubernetes-dashboard" -o jsonpath="{.items[0].metadata.name}")
kubectl -n default port-forward $POD_NAME 8443:8443
Now visit https://127.0.0.1:8443
to view dashboard login screen.
To get the token required for login you must run the following commands
kubectl describe serviceAccount kubernetes-dashboard
# Substitute for the actual token name
kubectl describe secret kubernetes-dashboard-token-xxxxx
Copy and paste the token into the login screen of the dashboard. Now you should be able to view the resources on your cluster.
2. Ghost
Installing the Ghost platform is even simpler than the dashboard.
Fist we need to add the Bitnami repo
helm repo add bitnami https://charts.bitnami.com/bitnami
Then we must run the same update command as above
helm repo update
And finally install Ghost
helm install ghost bitnami/ghost --set='ghostUsername=admin,ghostPassword=password,ghostBlogTitle=My Blog,mariadb.rootUser.password=superSecretpassword'
And that's it. Your very own Ghost instance should be up and running within minutes.
Subscribe
I will making this content like this and more so please consider supporting me by subscribing.
Sign up by using the button at the bottom right corner. Also conider supporting with a small monthly fee.
Happy Hacking :)