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.

Markdowm Image

Nick the Captain of our containers.

Nick is Kubernetes (Kubernetes originates from the Greek word helmsman of ship) of our Nodes e.g. Markdowm Image

Nick managing our Node

The Kubernetes cluster node we are using has a number of containers. One of which, is our app: Markdowm Image

Our app is a container on that Node

In reality though Nick manages multiple Nodes, in a true Kubernetes fashion: Markdowm Image

Nick managing multiple Nodes

How does this really look like in Kubernetes? Markdowm Image

Our Pod in the Cluster

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

Eg like:

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.7.9
    ports:
    - containerPort: 80

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.

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora