
Kubernetes explained deep enough
Part 1: Introduction — this blog
Part 2: Kubernetes explained deep enough: Storage
Part3: Kubernetes explained deep enough: Deployments
Part 4: Kubernetes explained deep enough: Configuration
Part 5: Services discoverability, DNS, cluster communication
For web version of this blog and more information about docker, Kubernetes and Docker Certification, please visit:
Why another Kubernetes series?
As the popularity of Kubernetes grows, so does the number of great online resources and learning materials. A lot of available information is either designed for absolute beginners or does a very deep dive into a specific topic.
My goal is to write about Kubernetes topics in a practical way, like storage, deployments, services etc and provide exercises scenarios for everyone to follow along. The idea is to focus on the core functionality, understand it well enough and exercise along. If you already watched a few tutorials and maybe created pod or deployment and are ready for the next level, this series is for you.
It can also be used as help in preparation for Kubernetes (CKA, CKAD, CKS) or Docker certifications (DCA).
Hopefully, after completing the series, you will:
- Have a deeper understanding of different Kubernetes aspects
- Understand what problem each of them solves
- Know how to implement it in practical scenarios
If you are new do Kubernetes, but still would like to follow along with the series I highly recommend checking out
- Collabnix Github — Kubelabs for excellent Kubernetes tutorials and exercises.
- Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours] from TechWorld with Nana
Kubernetes Sandbox
There are a lot of different options to play around with Kubernetes for free:
- Local installation with Minikube or MicroK8s
- Local installation with Vagrant and VirtualBox
- Local installation with Docker Desktop on Windows, Mac or Linux
- Remote cluster with Katakoda
- Remote cluster with free credits on any public cloud provider, 3 most popular ones: Azure AKS*, Google Cloud GKE, AWS EKS
- Remote cluster or local installation with LXC Containers
- Remote cluster PWK — Play With Kubernetes*
In most of the examples we are going to use PWK, because there is no need to install anything locally and the environment we end up with is powerful enough to get through all examples. Some examples will require cloud provider cluster and those will be done on AKS.
Follow instructions in This guide and setup 3 nodes cluster. 1 master and 2 worker nodes
git clone https://github.com/collabnix/kubelabs
cd kubelabs
sh bootstrap.sh
- Add nodes to cluster by executing command printed at the end of bootstrapping process
PWK is sometimes not responsive, so you need to close session and try again later
The guide asks to setup 5 nodes but for our purposes 3 are more than enough (1 master, 2 workers)
In case PWK is down or not responsive, I recommend installing Docker Desktop
Setting up cluster visualization tools
Once the cluster is ready, let’s setup some tools:
- Better
kubectl
: this is my wrapper aroundkubectl CLI
and can be installed with this command:
# .kube/config is a symlink to /etc/kubernetes/admin.conf
# running this container as root is only for testing purposes!docker run --network=host --name=kubectl-host -v /etc/kubernetes/admin.conf:/root/.kube/config --rm -it piotrzan/kubectl-comp:zsh
- Octant is a VMWare open source cluster visualizer, running in a browser so no local installation is required.
All those tools will allow us to move around the cluster easier and will help us visualize and learn.
Exercise files
Exercises and sample code is located in a separate repository. You can either clone it and work directly from the command line or use kubectl
with remote location of a file or folder you want to deploy.
Structure
Each post in the series will follow the same core structure:
- How does it work?
- What Problem does it solve?
- How to implement it?
Summary
Stay tuned for the first part in the series where we will tackle Kubernetes storage, specifically volumes, persistent volumes and persistent volume claims!