Repo for learning how to use Kubernetes and Helm charts with the help of Kubernetes in Action book.
- Create GKE project
gcloud auth login
gcloud config set project <GCP PROJECT ID>
- Run
gcloud auth configure-docker
- Run
refresh.sh
to update docker image to google docker repository - Connect kubectl to your cluster w/ gcloud container
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
- Install with
helm install --name test -f secrets.yml node-app-helm
Try db connection:
- Get pods
kubectl get po -o wide
kubectl port-forward <pod id> 8888:8888
- From another shell run
curl localhost:8888
- After changes upgrade with
helm upgrade test -f secrets.yml ./node-app-helm
- Run tests with
helm test --cleanup test
- Delete chart with
helm delete test --purge
- See why pod initialization fails
kubectl describe po <pod id>
- List pods
kubectl get po
- Get a list of your nodes
gcloud compute instances list
- ssh to a kube node
gcloud compute ssh <node name>
ifconfig eth0 down
gcloud compute instances reset <node>
Notes
- Templating doesn't work inside values.yml files. Maybe in helm 3.
- Subchart config overrides are done by using the chart name from the yaml file, not the folder name.
- Disruptions https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#voluntary-and-involuntary-disruptions
- Resource handling on nodes https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/