Introduction
Kubernetes is a container orchestrator designed for applications that run on containers and need the following things:- Service Discovery and Load Balancing
- Automatic Bin Packing
- Storage Orchestration
- Self Healing
- Secret and Configuration Management
- Automated Rollouts and Rollbacks
- Batch Execution
- Horizontal Scaling
Why you should use it
In the general process of deploying applications, we encounter various issues with the way we want to get it working. One problem with deploying applications in production before Kubernetes and other container orchestrators was the problem of managing resources. We had to spin up a server to deploy a new application. A server, in principle, should only hold one application, including all of its dependencies, which would have to be manually deployed via some CI process every time we wanted to use it. This process was very stressful and required many technical skills to manage various things such as networking, security, storage, and all that would go to waste if the server became unresponsive and stopped working due to various factors.Why Containers
Containers provide a good isolation level between the application and the machine running it. If the container running the application goes down, it doesn’t affect the machine. Since this is the case, we can spin up several containers on a single machine without hoping for conflict. Kubernetes provides this container management feature and the ability to run multiple servers in a cluster setup. Kubernetes can control these multiple machines by running a Control Plane, which defines how the master and slaves communicate with each other.The various parts of the Kubernetes Control Plane, such as the Kubernetes Master and kubelet processes, govern how Kubernetes communicates with your cluster. The Control Plane maintains a record of all of the Kubernetes Objects in the system and runs continuous control loops to manage those objects’ states. At any given time, the Control Plane’s control loops will respond to changes in the cluster and work to make the actual state of all the objects in the system match the desired state that you provided. Source: https://kubernetes.io/docs/concepts/#kubernetes-objects
Kubernetes Architecture
There are two cluster types in Kubernetes since it is generally for handling distributed workloads:- Master
- Slaves
Master
This is what we use to talk to the slaves. In Kubernetes, the master is the one we communicate about what deployments should be on our cluster and how they should be managed. The master delegates work to the slaves, who are responsible for starting the containers and ensuring they function as desired. The master does this using a collection of three processes:- API server (kube-apiserver)
- Controller manager (kube-controller-manager)
- Scheduler (kube-scheduler)
Slaves
These nodes do the grunt work of running services and all the applications needs. The Scheduler is the one that pushes the requests to them, and they are then monitored by the controller manager and interacted with by us through the API Server over the master. In general, the slaves run two things:- Kubelet
- Kube-Proxy
Containers in Kubernetes

Deployments and Containers
In Kubernetes, because we have different things like Networking, Storage, RAM, and CPU to manage amongst various applications that might or might not be similar, we interact with these various resources using Kubernetes Objects.Kubernetes contains several abstractions that represent the state of your system: deployed containerized applications and workloads, their associated network and disk resources, and other information about what your cluster is doing. These abstractions are represented by objects in the Kubernetes API Source: https://kubernetes.io/docs/concepts/#kubernetes-objectsThe basic Kubernetes objects include:
- Pod - Running Application
- Service - Networking and Port Allocation
- Volume - Storage and Disk Management
- Namespace - Sandbox For Running Multiple Versions
- ReplicaSet - Similar Pods Running Together
- Deployment - A higher group built on a collection of Pods which may or may not be similar
- StatefulSet - An application that has Volume requirements and should not start unless it is offered a separate and persistent space to store files
- DaemonSet - Just like a ReplicaSet, but this one should be present on all nodes running in the cluster
- Job - A short-running Pod, good for things like webhooks and email dispatchers
Exposing a Deployment With Services

kube-proxy
which can forward our request to the machine where it is deployed and send the response back through that same channel.