DevOps, Day - 30

What is Kubernetes? Write in your own words and why do we call it k8s?

1. What is Kubernetes (K8s)? Kubernetes is a powerful tool used to manage and orchestrate containerized applications, making it easier to deploy, scale, and manage them reliably and efficiently.

2. Why "K8s"? The name "K8s" is a shorthand for Kubernetes. It's a play on words where "K" represents the first letter, "8" stands for the eight letters between 'K' and 's,' and "s" is the last letter in "Kubernetes."

In summary, Kubernetes (K8s) is a powerful tool that simplifies the management of containerized applications, providing scalability, high availability, and self-healing capabilities while ensuring your applications run smoothly. The name "K8s" is a clever abbreviation derived from "Kubernetes."


What are the benefits of using k8s?

Some of the most important benefits of using Kubernetes (K8s):

  1. Container Orchestration: Kubernetes automates the deployment and management of containers, saving time and reducing manual effort.

  2. Scalability: Easily scale your applications up or down to meet changing demands.

  3. High Availability: Kubernetes ensures that your applications are highly available by distributing them across multiple nodes.

  4. Self-Healing: If an application or node fails, Kubernetes automatically replaces or repairs them to minimize downtime.

  5. Rolling Updates: You can update applications without service interruptions, allowing for seamless upgrades.

  6. Load Balancing: Kubernetes provides built-in load balancing for even traffic distribution.

  7. Resource Efficiency: Optimizes resource usage for cost savings in cloud environments.

  8. Declarative Configuration: Specify your desired state, and Kubernetes works to maintain it, reducing manual configuration.

  9. Portability: Kubernetes is cloud-agnostic, allowing you to run applications across different cloud providers or on-premises.


Explain the architecture of Kubernetes, refer to this video

Let's break down the architecture of Kubernetes in a simple and easy-to-understand way:

Imagine a City: Think of Kubernetes as a city where you want to manage many buildings (containers) efficiently.

1. Control Tower (Master Node):

  • The Control Tower is like the city's command centre.

  • API Server: It's like the mayor's office. You talk to the city through it.

  • etcd: Think of it as a city's big library. It stores important information about the city.

  • Controller Manager: These are like city planners. They make sure everything is working as planned.

  • Scheduler: Just like a tour guide, it decides where to place new buildings (containers) in the city.

2. Worker Zones (Worker Nodes):

  • These are the neighbourhoods in the city where the actual buildings (containers) are located.

  • Kubelet: Think of them as building caretakers. They make sure each building (container) is healthy.

  • Kube Proxy: Like traffic officers, they manage the traffic between buildings (containers).

  • Container Runtime: These are like construction workers. They build and manage the buildings (containers).

3. Buildings (Pods):

  • In our city, buildings are called "Pods."

  • Each Pod can contain one or more apartments (containers) where applications live.

  • Pods are the smallest units, like houses or apartments, in the city.

Summary: Kubernetes is like a well-organized city. The Control Tower (Master Node) manages the city's rules and plans, while the Worker Zones (Worker Nodes) are where the actual buildings (Pods) are located. The buildings (Pods) house the city's residents (containers). Everything is carefully coordinated to keep the city running smoothly.


What is a Control Plane?

Charmhub | Deploy Kubernetes Control Plane using Charmhub - The Open  Operator Collection

The Control Plane, often referred to as the "master" in Kubernetes, is one of the key components of a Kubernetes cluster. It is responsible for managing and controlling the overall state of the cluster. Here's a simple explanation:

Control Plane (Master):

  1. Central Command Center: Think of the Control Plane as the central control room or headquarters of a Kubernetes cluster. It's where all the important decisions and operations for the cluster are coordinated.

  2. Components: The Control Plane consists of several components, including:

    • API Server: This serves as the entrance for users and applications to interact with the cluster. It receives commands and communicates with other parts of the Control Plane to execute those commands.

    • etcd: It's like the database of the cluster, storing all the configuration data and the current state of the cluster. It's crucial for maintaining consistency and reliability.

    • Controller Manager: This component constantly observes the state of the cluster and makes necessary adjustments to ensure that the cluster behaves as expected. It's like an automated manager.

    • Scheduler: The scheduler decides where to place newly created pods (the smallest deployable units in Kubernetes) based on resource requirements, policies, and other constraints. It's like a city planner finding the best spot for new buildings.

  3. Cluster Governance: The Control Plane enforces policies and keeps the cluster in a desired state, ensuring that the applications are running as expected, scaling when needed, and self-healing in case of failures.

  4. User Interface: While not a part of the Control Plane itself, the Control Plane typically offers a user-friendly interface or dashboard for administrators and developers to interact with the cluster.

In summary, the Control Plane in Kubernetes is like the brains and central control hub of the cluster, responsible for making decisions, managing resources, and maintaining the desired state of the system. It ensures that everything in the cluster works as planned and responds to user and application requests.


Write the difference between kubectl and kubelets.

Aspectkubectlkubelet
PurposeCommand-line tool for cluster managementNode agent for container management on nodes
User InteractionUsed by administrators and developersRuns on worker nodes, no direct user interaction
Control Plane InteractionCommunicates with Control Plane componentsReports node status to Control Plane
Container ManagementManages resources, configurations, and deploymentsEnsures containers within pods are running correctly
Resource MonitoringMonitors cluster status and resourcesMonitors node resources and reports to the Control Plane
Container Runtime InteractionCommunicates with the Control Plane for cluster operationsDirectly interacts with container runtime (e.g., Docker)

Explain the role of the API server.

The API Server is a central component of the Kubernetes Control Plane (Master) and plays a crucial role in the orchestration and management of a Kubernetes cluster. Its role can be summarized as follows:

1. Entry Point for Cluster Communication:

  • The API Server serves as the entry point for communication between users, administrators, applications, and various components of the Kubernetes cluster. It acts as the central interface for issuing commands, making queries, and controlling the cluster.

2. Authentication and Authorization:

  • The API Server is responsible for authenticating users and applications that request access to the cluster. It verifies their identity and permissions, ensuring that only authorized actions are allowed within the cluster.

3. Validates and Processes Requests:

  • When you use tools like kubectl or send HTTP requests to the API Server, which validates and processes those requests. It checks the syntax and semantics of incoming requests to ensure they are well-formed and adhere to cluster policies.

4. Maintains Cluster State:

  • The API Server interacts with the etcd data store, which is like the cluster's database, to maintain the current state of the cluster. It retrieves configuration data, updates, and overall cluster status from etcd.

5. Exposes the Kubernetes API:

  • The API Server exposes the Kubernetes API as a RESTful service. This API allows users and applications to create, modify, or delete Kubernetes resources like pods, services, deployments, and more.

6. Communication Hub:

  • It acts as a communication hub within the Control Plane, forwarding requests to the appropriate components, such as the Scheduler and Controller Manager, to perform actions like scaling applications, scheduling workloads, and maintaining desired cluster states.

7. Handles Extensions and Custom Resources:

  • Kubernetes can be extended with custom resources and controllers. The API Server manages these extensions, allowing you to define and use custom objects and behaviours in your cluster.

8. Enforces Security Policies:

  • Security features like Role-Based Access Control (RBAC) and Network Policies are enforced by the API Server. It ensures that access to resources is controlled according to defined security policies.

In summary, the API Server is the core of the Kubernetes Control Plane. It serves as the primary gateway for cluster communication, ensuring that all actions are secure, well-formed, and consistent with the desired state of the cluster. It plays a pivotal role in making Kubernetes both manageable and secure.


Thank you so much for reading

Follow me on LinkedIn to see interesting posts like this : )

Linkedin

0
Subscribe to my newsletter

Read articles from Vrishni Shree V B directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vrishni Shree V B
Vrishni Shree V B

๐Ÿ’ป Python | Docker | Jenkins | Networking | Git | Linux ๐Ÿ’ป Passionate about leveraging technology to drive efficiency and deliver innovative solutions. Proficient in Python development, Docker containerization, Jenkins automation, computer networking, Git version control, and Linux administration. Skilled in collaborating with diverse teams to deliver high-quality software products. Proficient in AWS EC2 instance management and deployment. Seeking new opportunities to apply my expertise and contribute to impactful projects. Let's connect and explore how we can work together! Inter-personal Skills: Communication, Adaptability, Emotional intelligence, Active listening, Collaboration. Happy To Connect๐Ÿ”—๐Ÿ˜Š Feel free to reach me out๐Ÿ˜ƒ@ --> vrishnishreevb531@gmail.com ๐Ÿ“ฌ