Over the last few weeks I have been learning Kubernetes. Here is how I got set up and started learning.
To experiment with Kubernetes I used minikube to run a local cluster. This has dependencies of virtualbox and kubectl.
On Arch Linux minkube and kubectl may be installed from the AUR. Virtualbox is available in the core Arch Linux repositories. Once installed a Kubernetes cluster can be started as follows.
minikube start Starting local Kubernetes cluster... Kubectl is now configured to use the cluster.
Note that this can take some time to complete. Once complete some information can be gathered about the cluster.
kubectl cluster-info Kubernetes master is running at https://192.168.99.101:8443 KubeDNS is running at https://192.168.99.101:8443/api/v1/proxy/namespaces/kube-system/services/kube-dns kubernetes-dashboard is running at https://192.168.99.101:8443/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
Kubernetes ships with a dashboard that can be viewed as follows
Whilst it is possible to manage and deploy applications through the dashboard I prefer the command line! Nevertheless the dashboard is useful to visualise quickly what you have and it would be useful for teams to serve as a dashboard.
Now the cluster is running an image can be deployed into it. I used a Hello World web server written in Go that I had already created and pushed into the public registry.
kubectl run hello-go --image=shapeshed/hello-go --port=8080
kubectl expose deployment hello-go --type=NodePort
kubectl get pod NAME READY STATUS RESTARTS AGE hello-go-772128995-1x5wj 1/1 Running 0 12m
minikube service hello-go --url
Visiting the URL serves the application through Kubernetes.
Getting Kubernetes up and running on Arch Linux was really straightforward and I found the documentation to be fantastic. I now have an environment where I can experiment with exploring more of what Kubernetes can do.
Have an update or suggestion for this article? You can edit it here and send me a pull request.
Using HashiCorp Vault with LDAP
How to use HashiCorp Vault to setup an LDAP backed secret store with read-only access for users in groups and read-write access for specific users
Linux and Unix xargs command tutorial with examples
Tutorial on using xargs, a UNIX and Linux command for building and executing command lines from standard input. Examples of cutting by character, byte position, cutting based on delimiter and how to modify the output delimiter.
Copy a file in Go
How to copy a file in Go. The ioutil package does not offer a shorthand way of copying a file. Instead the os package should be used.