Installing k8s resources with Helm charts

Published on May 10, 2024

Helm charts are used to encapsulate and simplify deployments to Kubernetes. They allow applications to be deployed quickly in a consistent way. Let's deploy an application into our local cluster to help us get started with using Helm since I'll be using it quite a bit in following blogs.

Deploying

Create a local kubernetes cluster with k3d.

k3d cluster create my-cluster -p "8080:80@loadbalancer"

Install the WordPress chart.

helm install my-wordpress oci://registry-1.docker.io/bitnamicharts/wordpress

And apply the ingress route.

kubectl create ingress my-wordpress --rule="/=my-wordpress:80"

Wait a minute or so until Wordpress has spun up and all the pods are ready.

$ kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
my-wordpress-mariadb-0          1/1     Running   0          2m12s
my-wordpress-67bdcfb65d-56tlh   1/1     Running   0          2m12s

Visit WordPress home page http://localhost:8080/.

Get the WordPress password for the admin user called user.

kubectl get secret --namespace default my-wordpress \
  -o jsonpath="{.data.wordpress-password}" |
  base64 -d

And then log in to the admin console at http://localhost:8080/admin with those credentials. I'd say that is a contender for the easiest way to spin up WordPress stack.

Going further with Helm charts

Helm charts are a powerful tool in the k8s kit bag, especially when it comes to providing consistent and controlled deployments. They can encapsulate complexity and expose configuration points for the platform to application developers. There are lot of ready bakes charts created by the community and the charts allow controlled configuration, e.g. with a values.yaml. If you are working on components in your team you may create Helm charts to encapsulate your concerns and reduce the cognitive load of others using you components.

I'll be using Helm charts in future posts, and wanted to quickly cover the basics first. These steps have also got us to a point where we have a local environment set up to explore Helm further.

Clean up

Delete the k3d cluster when you are done, which will tear down the Wordpress deployment along with the cluster, so that future exercises can start from a clean point.

k3d cluster delete my-cluster