Kubernetes Made Easy A Beginner-Friendly Introduction

August 7, 2023by Dhawal
What is Kubernetes?

Kubernetes, developed by Google, is a powerful open-source tool that simplifies containerized application management across various environments. Effortlessly scale and deploy containerized applications with Kubernetes, an intuitive and production-grade orchestration solution.

Why is it used?

Kubernetes is used to simplify application management and automate infrastructure, freeing developers to innovate and boost productivity.

What features Does Kubernetes Offer?

Kubernetes offers automatic load balancing and scaling for seamless application management, ensuring reliability and simplifying container orchestration with declarative configuration and self-healing capabilities.

 

Kubernetes architecture

In the Kubernetes architecture, a cluster comprises worker nodes hosting containerized applications, while the control plane orchestrates these nodes and manages the application workload. With fault tolerance and high availability, multiple nodes and control plane instances ensure seamless operations in production environments.


The components of a Kubernetes cluster

 

Control Plane Components

Control plane components in Kubernetes are flexible and can be executed on any machine within the cluster, providing scalability and adaptability to meet the dynamic needs of the application environment.

 

kube-apiserver

The kube-apiserver is like the front door of a Kubernetes cluster, allowing users and applications to communicate with the cluster and ensuring that only authorized parties can access and manage the resources within, making container management simple and secure

etcd

etcd acts as the backbone of your Kubernetes cluster, ensuring data consistency and availability. Safeguarding this critical component with a robust backup plan is essential to maintain cluster reliability and continuous operations.

kube-scheduler

Kube-scheduler acts as the smart organizer in Kubernetes, deciding which nodes should run new Pods, ensuring optimal performance and resource utilization within the cluster.

kube-controller-manager

Kube-controller-manager, a crucial Kubernetes control plane component, manages various controller processes, each responsible for specific tasks like node monitoring, job execution, EndpointSlice population, and ServiceAccount creation, ensuring efficient cluster operations and resource management. Its streamlined approach, consolidating multiple controllers into a single binary, reduces complexity and enhances overall system stability.

cloud-controller-manager

The cloud-controller-manager simplifies Kubernetes’ communication with your cloud provider’s API by consolidating controllers, making it more efficient to manage cloud-related elements in the cluster.

Node Components

Node components in Kubernetes run on each node, ensuring the continuous operation of running pods and providing the necessary runtime environment for Kubernetes workloads.

Kubelet

Kubelet is an agent on each node, ensuring containers in Pods are running and healthy based on provided PodSpecs, while it doesn’t manage non-Kubernetes containers.

kube-proxy

kube-proxy as the traffic manager of Kubernetes, running on each node, directing network communication to and from Pods, ensuring smooth service exposure and efficient connections both within and outside the cluster.

Container runtime

The container runtime executes containers, and Kubernetes supports containerd, CRI-O, and other CRI implementations, providing flexibility and compatibility in container management.

Pods

Pod acts as a bundled group of one or more containers, working together as a single unit, sharing storage and network resources, and facilitating easier application management with options for initialization and on-the-fly debugging.

Deploy sample nginx pod using yaml file

kubectl apply -f simple-pod.yaml

 

vim simple-pod.yaml

apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
Some Of The Key K8s components Are :

Services & Ingress: Enable seamless communication between external users and applications in the cluster and facilitate internal communication among pods.

ConfigMaps: Manage and provide endpoint URLs required by pods or databases for configuration purposes.

Secrets: Secrets provide a safe haven for safeguarding sensitive data like passwords and keys, using base64 encoding to ensure confidentiality and secure application communication.

Volumes: Ensure persistent data storage, allowing data to persist across container restarts.

Deployments: Handle creating replicas and managing stateless applications for efficient scaling and updates.

StatefulSets: Used for stateful applications and databases that require unique identity and stable network identity in the cluster.