Hello Kubernetes World

from Centre for Digital Humanities

presentation repo: https://github.com/centrefordigitalhumanities/hello-kubernetes-world/

Outline

  • Why Kubernetes?
  • What is Kubernetes?
  • Cluster components
  • Basic objects
  • Minikube
  • Examples: Hello World, Snake, Bonus      
  • Next steps



Why Kubernetes?      

Over the years, people called developers started
virtualizing and containerizing applications (separation of concerns)      
image: https://kubernetes.io/docs/concepts/overview/

Docker containers      

"It works on my machine"
"Then we will ship your machine to the customer"

Containers made it easy to seperate applications but managing hundreds of containers was cumbersome... Kubernetes to the rescue!

image: https://k21academy.com/docker-kubernetes/docker-and-kubernetes/







Kubernetes features     

After a container image is pushed into a registry,
Kubernetes gets into the scene.

What is Kubernetes?    

Kubernetes is a distributed container orchestration platform
for automating deployment and management of applications at scale.



    Kubernetes is also:
  • Open Source
  • Distributed
  • Extensible
  • Declarative
  • Resilient

image: https://tudip.com/blog-post/managing-deployments-using-kubernetes-engine/

What is Kubernetes??      


Kubernetes is the "linux kernel" of distributed systems.
*
It abstracts away the underlying infrastructure and provides a uniform interface for applications to be both deployed and consume the shared pool of resources.
*
Kubernetes can run in nodes: on cloud, on premises and even a combination.




Cluster Components

Node: a physical or virtual machine that contributes resources
Cluster: a group of master control plane and worker data plane nodes


image: https://faun.pub/kubernetes-chronicles-k8s-01-introduction-to-kubernetes-architecture-18cad51d270f

Control Plane

kube-apiserver: allows user interaction with the cluster (CLI/UI)
etcd: stores key-value pairs for cluster configuration (state, parameters, secrets)
kube-scheduler: decides which node a pod will run on
kube-controller-manager: shifts the actual state of the cluster to the desired state (acts as cluster thermostat)





For high availability,
the control plane runs on multiple nodes.

Data Plane

kubelet: agent that ensures that containers are running, reports to the apiserver
kube-proxy: facilitates networking between pods and handles external traffic
container runtime: (ie. Docker) pulls and runs container images from a registry


Basic Objects



Pod: the smallest computational unit, plugs&plays container(s), ephemeral in nature
*
Deployment: manages the lifecycle of identical pods by scaling, updating, self-healing
*
ConfigMap/Secret: holds data as key-value pairs, passwords and keys kept secret
*
Service: provides a stable IP address and DNS name for reaching a deployment





More Objects

StatefulSet: same as a deployment but for applications with persistent storage
*
Persistent Volume (PV): represents a piece of storage that can be attached to pods
*
Persistent VolumeClaim (PVC): requests PV resources with specific characteristics
*
Namespace: groups and isolates kubernetes objects in seperate spaces




Label: nametags kubernetes objects; useful to select, identify, inform


even more on: https://kodekloud.com/blog/kubernetes-objects/

Minikube


						brew install minikube
						minikube start
						minikube dashboard
						docker ps # 🤯
						minikube config set memory 4096
						kubectl get # watch kubectl get all 
						k9s
					
an important file: ~/.kube/config

tutorial: how-to-use-minikube-for-local-kubernetes-development-and-testing@digitalocean
kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ | k9s: https://k9scli.io/

Examples


						kubectl run minicurl --image=curlimages/curl -i --tty -- sh
						kubectl apply -f hello-k8s-message.yaml # or through dashboard
						kubectl apply -f kubesnake.yaml # or through dashboard
						minikube ip # or minikube service  --url
						minikube delete # 💥
					
example1: hello-k8s-message.yaml | example2: kubesnake.yaml
.
.
Bonus

Next steps



  • Networking ie. Ingress with load balancer
  • Autoscaling ie. Horizontal Pod Autoscaler
  • RBAC - Role Based Access Control
  • RedHat Openshift ITS
    ie. Rootless Containers, Routes, Storage     
  • Helm & Kustomize package managers
  • ArgoCD for automatic deployments
  • Plugins ie. for backup, monitoring, metrics



image: https://www.cncf.io/phippy/the-childrens-illustrated-guide-to-kubernetes/

Qubi..nitis

/ˌk(j)uːbərˈnɛtɪs, -ˈneɪtɪs, -ˈneɪtiːz, -ˈnɛtiːz/
Cuba..nitas! K8s: Kate's