WILT: Kubernetes

Looking into Kubernetes, some initial command preservation

Kubernetes, being able to orchestrate full deployments w' scaling etc. using YAML files - I remain a proponent of infrastructure-as-code in a human readable and version controllable fashion.

You need a kubectl command line tool to interact with kubernetes, and minikube is what I'm using to run local kubernetes. Grab them from Kubernetes Documentation / Tasks / Install tools.

My Wordpress Kube thing that runs on M1 (see below) is zipped and downloadable. It's based on the stateful example at Kubernetes.io Wordpress deploy example

Online references

Name URL Good for
Kubernetes Documentation https://kubernetes.io Really good at getting started. Nice collection of usable commands
bitnami/charts bitnami/charts/wordpress Kubernetes document recommends using this via helm to run a production ready Wordpress. To review
Package manager for Helm Helm Docs ...managing your deployed packages


Command Used for Example
minikube start Starting your local cluster
kubectl version Checking version of client and server - good to verify the server's running
kubectl get Get information on things kubectl get nodes - Show all nodes in the cluster
kubectl create deployment Create a deployment kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 - Deploy the Google sample application
kubectl describe Get details on primitives kubectl describe pods - Get pod information
kubectl logs Get logs for a pod kubectl logs $POD_NAME - Get the logs for pod $POD_NAME
kubectl expose Open ports that will direct traffic to services kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080 - Expose a port 8080 for the kube, but we need to tie in the external port you can get it from!
kubectrl exec Running stuff in the container from outside kubectl exec --stdin --tty <container> -- /bin/bash - Get an interactive shell on the container
helm Automates a bunch of Kubernetes things, using Chart and Value files, among others See the Bitnami online reference above for a functioning use



Mac's M1 ARM64 architecture gives Docker conniptions. Since my training repos are from Docker images, naturally things went to hell - out of the box tutorials using MySQL failed. Some searching found someone hosting arm64 compiled MySQL architectures so I could use those. Thanks, Jamiel Sharief.


You need to use expose to get an internal port assigned a kube port; then you can use that kube port to connect:

1kubectl expose deployment/[thing] --type="NodePort" --port 8080
2export NODE_PORT=$(kubectl get services/[service-name] -o go-template='{{(index .spec.ports 0).nodePort}}')
3curl $(minikube ip):$NODE_PORT