WHAT IS KUBERNETES
Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
Let’s take a look at why Kubernetes is so useful by going back in time.
Traditional deployment era: Early on, organizations ran applications on physical servers. There was no way to define resource boundaries for applications in a physical server, and this caused resource allocation issues. For example, if multiple applications run on a physical server, there can be instances where one application would take up most of the resources, and as a result, the other applications would underperform. A solution for this would be to run each application on a different physical server. But this did not scale as resources were underutilized, and it was expensive for organizations to maintain many physical servers.
Virtualized deployment era: As a solution, virtualization was introduced. It allows you to run multiple Virtual Machines (VMs) on a single physical server’s CPU. Virtualization allows applications to be isolated between VMs and provides a level of security as the information of one application cannot be freely accessed by another application.
Virtualization allows better utilization of resources in a physical server and allows better scalability because an application can be added or updated easily, reduces hardware costs, and much more. With virtualization you can present a set of physical resources as a cluster of disposable virtual machines.
Each VM is a full machine running all the components, including its own operating system, on top of the virtualized hardware.
Container deployment era: Containers are similar to VMs, but they have relaxed isolation properties to share the Operating System (OS) among the applications. Therefore, containers are considered lightweight. Similar to a VM, a container has its own filesystem, share of CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions
The machines that make up a Kubernetes cluster are called nodes.
Nodes in a Kubernetes cluster may be physical, or virtual.
There are two types of nodes:
- A Control-plane-node type, which makes up the Control Plane, acts as the “brains” of the cluster.
- A Worker-node type, which makes up the Data Plane, runs the actual container images (via pods).
K8S OBJECTS OVERVIEW
Kubernetes objects are entities that are used to represent the state of the cluster.
An object is a “record of intent” – once created, the cluster does its best to ensure it exists as defined. This is known as the cluster’s “desired state.”
Kubernetes is always working to make an object’s “current state” equal to the object’s “desired state.” A desired state can describe:
- What pods (containers) are running, and on which nodes
- IP endpoints that map to a logical group of containers
- How many replicas of a container are running
- And much more…
K8S OBJECTS DETAIL
- A thin wrapper around one or more containers
- Implements a single instance of a pod on a worker node
- Details how to roll out (or roll back) across versions of your application
- Ensures a defined number of pods are always running
- Ensures a pod properly runs to completion
- Maps a fixed IP address to a logical group of pods
- Key/Value pairs used for association and filtering
KUBERNETES ARCHITECTURE OVERVIEW
- One or More API Servers: Entry point for REST / kubectl
- etcd: Distributed key/value store
- Controller-manager: Always evaluating current vs desired state
- Scheduler: Schedules pods to worker nodes
Check out the official Kubernetes documentation for a more in-depth explanation of control plane components.
- Made up of worker nodes
- kubelet: Acts as a conduit between the API server and the node
- kube-proxy: Manages IP translation and routing
Check out the official Kubernetes documentation for a more in-depth explanation of data plane components.
KUBERNETES CLUSTER SETUP
In addition to the managed Amazon EKS solution, there are many tools available to help bootstrap and configure a self-managed Kubernetes cluster. They include:
- Minikube – Development and Learning
- Kops – Learning, Development, Production
- Kubeadm – Learning, Development, Production
- Docker for Mac – Learning, Development
- Kubernetes IN Docker – Learning, Development
Alongside these open source solutions, there are also many commercial options available.
Let’s take a look at Amazon EKS!