Asking questions is one of the best ways to understand a new topic. It is like you are preparing tiny rooms in your brain to fill with new information.
Here are some questions I asked myself while studying Kubernetes.
The responses are brief, not enough to understand Kubernetes, but useful to test yourself and recall the concepts.
What is Kubernetes?
K8s is an Open Source container orchestrator for deploying containerized applications.
What are the functionalities of a container orchestrator?
- deploying services that span multiple containers
- scheduling containers across a cluster
- scaling the containers
- managing containers health over time.
Who created it?
Google created K8s in 2014 and later donated it to the Cloud Native Computing Foundation (CNCF).
What are the advantages of using Kubernetes?
Velocity, scaling application, scaling Dev Team, abstraction andefficiency:
K8s allows you to ship more updates than a traditional deployment - which uses ad hoc scrips - while maintaining a highly available service.
Scaling your application service is just a matter of changing a number in a configuration file.
Scaling Dev Teams is simpler. With service-oriented teams, each team can work on a single Microservice.
The K8s abstraction is not infrastructure-oriented but application-oriented based. That is why transferring your application between clusters is going to be painless. Today, there are many plug-ins that support most of the cloud platforms (AWS, GCP, Azure, …).
K8s exploits efficiently its resources. It automates the distribution of application across a cluster of machines, ensuring high level of utilization.
What are the two main parts of a Kubernetes cluster?
- A set of machines called worker nodes. They run the containerized applications.
- The control plane (master). It manages the worker nodes and the Pods (hosted inside the nodes).
What are the main parts of the control plane?
- kube-apiserver: it allows you to communicate to the cluster. It exposes a restful Http interface. Every time you query the cluster with
kubectl, you are de facto making API calls to the kube-apiserver.
- etcd: It is a key-value store, it contains the records of intent, and it is the only stateful component in the control plane.
- scheduler: its job is to find the best nodes to run the workloads. For example, let's say you want to deploy a Web app, and you want three running instances. The job of the scheduler is to find the nodes having the right resources to run the three web servers.
- background control loops: it continuously checks that the status of the cluster is the same as that one stated in the records of intent.
How can you interact with the Kubernetes Cluster?
There are three ways:
- by the command line client
- by direct access to the REST API with an Http client
- by programmatic access to the API (Golang, Python, Java, ...)
What is kubectl?
It is the command-line interface, which allows you to query or tweak the cluster. It talks with the cluster via API calls to kube-apiserver.
To update the cluster you should create the manifest files, and apply them with the command:
kubectl apply -f my_manifest.yaml
What is a manifest file?
A file manifest is a YAML file containing the description of the objects that are passed in the K8s API. K8s relies on declarative configuration and the manifest files describe the desired state.
Can you create a Pod object without using a manifest?
Yes, you can use create a Pod, or other objects, via the imperative
Anyway, the preferred way is to use a manifest YAML file, since you can treat it as source code.
What is an object in Kubernetes?
A Kubernetes object is a record of intent. Once you create the object, the K8s controllers will constantly monitor it, to ensure its requirements are met.
Some examples of objects are Pods, ReplicaSet and Deployments
Can you run a Kubernetes cluster on your laptop?
Yes. Using a platform called Minikube.
What is Minikube?
Minikube is a lightweight Kubernetes implementation that creates a virtual machine on your laptop and deploys a simple cluster.
Note that Minikube has a limitation: its cluster has only one node.
In which platform can you deploy a K8s cluster?
- on your local machine, using Minikube
- on bare metal servers
- on many commercial cloud platforms
What is a Pod?
A Pod is a set of application containers (usually only one) running in the same execution environment.
It can be described in a YAML manifest file, often within a ReplicaSet or Deployment object.
Which resources do application containers share within a single Pod?
- IP address
- port space (network namespace)
- interprocess communication channels
Does the Pods persist data in the filesystem?
No, Pods are stateless. When you restart a Pod, all data in the container's filesystem is deleted.
How can you persist data in a Pod?
Here is a book and two courses I am using to learn Kubernetes:
- Book: Up and Running: Dive Into the Future of Infrastructure
- Course on udemy: Kubernetes 101 - by Nigel Poulton
- Course on Manning: Kubernetes Microservices - by Richard Chesterwood
And, last but not least, the official documentation
If this article had a version this would be 0.1V.
It is a WIP and as soon as I practice more with K8s and grasp more knowledge I will expand it with more questions.
Please, feel free to suggest more questions or report any error.