Kubernetes a childs guide
As most of my “blogs” on this site, this post is a point of reference for me. A quick guide of the things I learned and has most probably forgot over time. I plan on coming back to this and adding (or removing) information I dont agree with or I don’t find useful anymore.
Kubernetes
In my mind its just a management system of containers. Deploying them, managing them, failure recovery and scaling. Primarily used for micro services. The most common use case for kubernetes is with docker containers.
“Kubernetes is a portable, extensible open-source platform for managing containerized workloads and services” - kubernetes.io
But to be honest, how I visualise Kubernetes, is with the metaphor of Nick the Captain.
Nick is Kubernetes (Kubernetes originates from the Greek word helmsman of ship) of our Nodes e.g.
The Kubernetes cluster node we are using has a number of containers. One of which, is our app:
In reality though Nick manages multiple Nodes, in a true Kubernetes fashion:
How does this really look like in Kubernetes?
What is a container
Containers let you isolate an application so that its under the impression its running on its own private machine
The most popular container platform for this is Docker.
What do I need to get started
- A dockerised application.
- A yml file so k8s knows what it needs for your app.
Eg like:
How can you manage the cluster
At the moment, my team and I use Tectonic. Tectonic helps us check deployments and manage the cluster to some basic extent. However, its not perfect such as as losing the logs, unable to retrieve the event history for pods, not being very descriptive and a lot of black magic related to it.
Most of the time we feel we don’t have control of our own clusters. We are actively investigating other solutions, primarily moving to AWS EKS and using the default kubernetes dashboard.
Kubectl
The kubectl
commands I tend to you on a daily basis are:
kubectl get pods --namespace ltatakis
Checking which env I am currently working on
kubectl config get-contexts
Choosing my namespace to work in
kubectl config use-contexts THE-ENV-I-WANT-2-USE
Deleted a namespace
kubectl delete namespaces
But by far the most useful one I use is:
kubectl --namespace ltatakis exec -it my-amazing-app-pod -- /bin/sh
Thats all for now folks!
If you notice any mistakes please contact me on Twitter.