Prerequisites
- Kubernetes
- kubectl
- helm
- git
- tree
Assignment
1
| apt update && apt install -y git tree
|
1
| curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
- Navigate into the newly created flappy-app directory and explore the Helm chart’s structure.
- Now, customize the Chart.yaml file.
- This file contains key information about our Helm chart, such as the chart name and description.
- Edit the file to set the description to
Flappy Dock Game Helm chart
(without quotes) and leave the version as it’s default:
- Modify the values.yaml file to set the image repository to
spurin/flappy-dock
and use the latest
tag (again without quotes for both). - Also, disable the serviceAccount by setting its related boolean values to false.
- Package the Helm chart for distribution. This step demonstrates Helm’s versatility in chart management and version control -
- Deploy the application using the packaged Helm chart. This showcases Helm’s ability to manage applications from packaged charts, which is useful for version control and distribution:
1
| helm install flappy-app ./flappy-app-0.1.0.tgz
|
- Helm would have provided us with some convenient commands, for ease we can run these as follows, this will also set up a port-forward to our application (you may need to retry if the app isn’t running) -
1
| export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=flappy-app,app.kubernetes.io/instance=flappy-app" -o jsonpath="{.items[0].metadata.name}"); export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}"); echo "Visit http://127.0.0.1:8080 to use your application"; kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT
|
Bring up a new tab to the Reverse Proxy and select the following - Control Plane ➜ 127.0.0.1 ➜ 8080 and then press Go, have some fun with the game and when complete, move back to the previous tab and press ctrl-c
Explore the deployed Kubernetes resources to understand how Helm interacts with Kubernetes. Check the deployment, pods, and services created by our Helm chart -
1
| kubectl get deployment; echo; kubectl get pods; echo; kubectl get svc
|
- Check whats showing from a helm viewpoint:
- And then, let’s uninstall the Helm chart to clean up the deployed resources -
1
| helm uninstall flappy-app
|
Finally, let’s clean up the environment -
1
| cd ..; rm -rf flappy-app
|