This is the second in a series of four articles on how to implement service mesh for applications running on Kubernetes. The first installment, “What are Containers and Why Do We Need Them?” discussed the elements and importance of containers.
Kubernetes has been built based upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community. It groups containers that make up an application into logical units for easy management and discovery.
Kubernetes is a production-ready, open source platform designed with Google’s accumulated experience in container orchestration, combined with best-of-breed ideas from the community. It is designed to automate deploying, scaling and operating application containers.
Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit. The abstractions in Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines.
In short, it is:
- Portable: public, private, hybrid, multi-cloud.
- Extensible: modular, pluggable, hook able, composable.
- Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling.
Kubernetes Architecture: Key Components and Abstractions
Following would help you to learn about the different parts of the Kubernetes system and the abstractions. Kubernetes automates the entire distribution and scheduling of application containers across a cluster in a more efficient way.
- To interact, there is an API layer exposed, same can be interacted using command-line interface via kubectl
- Any cluster (example below) would have two types of resources:
- Master which controls the cluster
- Node are the workers nodes that runs applications
- The Master coordinates all activities in your cluster, such as scheduling applications, maintaining applications’ desired state, scaling applications, and rolling out new updates etc.,
- Each Node can be a VM or a physical computer that serves as a worker machine in a cluster. Each node has a Kubelet, which is an agent for managing the node and communicating with the master. The node should also have tools for handling container operations, such as Docker or rkt.
- When any applications need to be deployed on Kubernetes, master issues command to start the application containers. The master schedules the containers to run on the cluster’s nodes.
- The nodes communicate with the master using the Kubernetes API, which the master exposes. End users can also use the API directly to interact with the cluster.
Master components provide the cluster’s control plane. Kubernetes Control Plane consists of a collection of below processes on your cluster:
- Master collection of three processes: kube-apiserver, kube-controller-manager and kube-scheduler.
- kube-apiserver exposes the Kubernetes API. It is the front end for the control plane.
- kube-controller-manager runs controllers, which are the designed to handle routine tasks in the cluster.
- Each individual non-master node on the cluster runs two processes:
- kubelet– this is to communicate with Master.
- kube-proxy– this is nothing but network proxy (Kubernetes networking services) on each node.
- kube-scheduler is to keep watch for newly created pods that have no node assigned, and selects a node for them to run on.
Master components make global decisions about the cluster (such as, for example, scheduling applications), and detecting and responding to cluster events.
Apart from the above, there are other objects to represent the state of system, some of the basic objects include:
Kubernetes clusters can run on various platforms: from your laptop, to VMs on a cloud provider, to a rack of bare-metal servers. To try with local setup, you can use Minikube. Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS and Windows systems.
There is also web-based dashboard for clusters. It allows users to manage and troubleshoot applications running in the cluster, as well as the cluster itself.
We have looked at the introduction and key concepts of Kubernetes platform. In the next section, we are going to create new clusters using Minikube.