A Beginner’s Guide to Kubernetes

Imesh Gunaratne
May 23, 2018 · 15 min read

Kubernetes Architecture

Image for post
Image for post
Figure 1: Kubernetes Architecture

Application Deployment Model

Image for post
Image for post
Figure 2: Kubernetes Application Deployment Model
kubectl run <application-name> --image=<container-image> --port=<port-no>

Service Discovery & Load Balancing

Image for post
Image for post
Figure 3: Kubernetes Service Discovery & Load Balancing Model

How Services Internally Work

Image for post
Image for post
Image for post
Image for post
Figure 4: Kubernetes Service Proxy Modes (Userspace, iptables, & ipvs), reference [4]

Internal/External Routing Separation

Image for post
Image for post
Figure 5: Kubernetes Internal/External Routing Separation
kubectl expose deployment <application-name> --type=LoadBalancer --name=<service-name>

Usage of Persistent Volumes

Image for post
Image for post
Figure 6: Kubernetes Persistent Volume Binding Models

Deploying Daemons on Nodes

Image for post
Image for post
Figure 7: Deploying Daemons on Kubernetes Nodes

Deploying Stateful Distributed Systems

Image for post
Image for post
Figure 8: Stateful Component Deployment Model

Running Background Jobs

Deploying Databases

Configurations Management

kubectl create configmap <map-name> <data-source># map-name: name of the config map
# data-source: directory, file or literal value

Credentials Management

# write credentials to two files
$ echo -n 'admin' > ./username.txt
$ echo -n '1f2d1e2e67df' > ./password.txt
# create a secret
$ kubectl create secret generic app-credentials --from-file=./username.txt --from-file=./password.txt

Rolling Out Updates

Image for post
Image for post
Figure 9: Kubernetes Rolling Update Process
$ kubectl set image deployment/<application-name> <container-name>=<container-image-name>:<new-version>
$ kubectl rollout status deployment/<application-name>
Waiting for rollout to finish: 2 out of 3 new replicas have been updated...
deployment "<application-name>" successfully rolled out

Autoscaling

Image for post
Image for post
Figure 10: Kubernetes Pod Autoscaling Model
kubectl scale --replicas=<desired-instance-count> deployment/<application-name>

Package Management

Image for post
Image for post
Image for post
Image for post
Figure 11: Helm and Kubeapps Hub

Conclusion

References

ContainerMind

Containerizing Software Applications

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store