K8s Tutorials Helm Charts

This repository contains 4 Helm charts that following the tutorials.

Prerequisites

  1. Docker
  2. Minikube
  3. Helm 3

Getting Started

  1. Install prerequisites tool above.
  2. Start the minikube cluster.
$ minikube start

Exercise Helm Charts

1. Example: Deploying PHP Guestbook application with Redis (https://kubernetes.io/docs/tutorials/stateless-application/guestbook/)

To perform helm deployment:

$ helm upgrade --install guestbook ./php-guestbook

To get the IP address for the frontend Service:

$ minikube service frontend --url

To uninstall resources:

$ helm uninstall guestbook

2. Example: Deploying WordPress and MySQL with Persistent Volumes (https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/)

To perform helm deployment:

  1. Generate deployment.yaml by templates
$ helm template ./wordpress-mysql > ./wordpress-mysql/outputs/deployment.yaml
  1. Apply kustomization.yaml secret
$ kubectl kustomize ./wordpress-mysql/outputs > ./wordpress-mysql/templates/deployment.yaml
  1. Perform the deployment
$ helm upgrade --install wordpress ./wordpress-mysql --set template.enabled=false

To get the IP address for the wordpress Service:

$ minikube service wordpress --url

To uninstall resources:

$ helm uninstall wordpress

3. Example: Deploying Cassandra with a StatefulSet (https://kubernetes.io/docs/tutorials/stateful-application/cassandra/)

To perform helm deployment:

  1. Remove and recreate Minikube to avoid insufficient resource, start Minikube with the following settings
$ minikube delete
$ minikube start --memory 5120 --cpus=4
  1. Perform the deployment
$ helm upgrade --install cassandra ./cassandra-statefulset

To get Cassandra StatefulSet:

$ kubectl get statefulset cassandra

To uninstall resources:

$ helm uninstall cassandra

4. Running ZooKeeper, A Distributed System Coordinator (https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/)

You will require a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. So, I perform the deployment with the GKE cluster.

To perform helm deployment:

  1. Connect to the GKE cluster
$ gcloud container clusters get-credentials [cluster name] --zone [zone] --project [project id]
  1. Perform the deployment
$ helm upgrade --install zookeeper ./zookeeper-coordinator
  1. Check the StatefulSet's Pods, Use CTRL-C to terminate to kubectl when all Pods is running.
$ kubectl get pods -w -l app=zk

To uninstall resources:

$ helm uninstall zookeeper