Day 30 Task: Kubernetes Architecture

Day 30 Task: Kubernetes Architecture

Day30 of 90daysofdevops

Β·

5 min read

Kubernetes Overview

With the widespread adoption of containers among organizations, Kubernetes, the container-centric management software, has become a standard to deploy and operate containerized applications and is one of the most important parts of DevOps.

Originally developed at Google and released as open-source in 2014. Kubernetes builds on 15 years of running Google's containerized workloads and the valuable contributions from the open-source community. Inspired by Google’s internal cluster management system, Borg,

Tasks

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

Kubernetes is an open-source Container Management tool that automates Container deployment, container scaling & load balancing. It's used for bundling and managing clusters of containerized applications K8s as an abbreviation results from counting the eight letters between the "K" and the "s".

πŸš€ What are the benefits of using k8s?

  1. Scalability: K8s allows you to easily scale your application up or down by adding or removing containers as needed. This makes it easier to manage large applications and handle sudden spikes in traffic.

  2. High availability: K8s provides automatic failover and rescheduling of containers if a node fails, ensuring high availability of your application.

  3. Portability: K8s allows you to deploy your application on any cloud provider or on-premise infrastructure, making it easier to move your application between different environments.

  4. Automation: K8s automates many tasks such as deployment, scaling, and self-healing, reducing the manual effort required to manage your application.

  5. Resource efficiency: K8s optimizes the use of resources by scheduling containers on nodes with available resources, ensuring that resources are used efficiently.

  6. Security: K8s provides several security features such as network policies, secure communication between containers, and role-based access control (RBAC), making it easier to secure your application.

πŸš€ Explain the architecture of Kubernetes, refer to this article

πŸš€ What is Control Plane?

In Kubernetes (K8s), the Control Plane refers to the set of components that manage and control the overall behavior of the Kubernetes cluster. The Control Plane includes several components that work together to provide the necessary functionality for K8s to operate effectively, including:

1. Kube-API server (For all communication)

This API server interacts directly with the user (i.e. we apply .yml or json manifest to kube-Apiserver)

2. ETCD Cluster

Stores metadata and status of Cluster.

ETCD is a consistent and high-available store (Key-value store)

Source of touch for cluster state (info about the state of the cluster)

3. Kube-Scheduler

Responsible for scheduling the pods on the nodes.

It just decides which pod to place on which node band on the CPU, RAM, and resources on the Node.

Kubelet places the nodes after the scheduler decides.

The right container/pod is sent to the right snip/node.

4.Kube-Controller Manager

Continuously monitor various components of the cluster and works toward managing/restoring to the desired state.

πŸš€ Write the difference between kubectl and kubelet.

kubectl and kubelet are both important components of Kubernetes (K8s), but they serve different purposes in the K8s architecture. Here are the differences between kubectl and kubelet:

  1. Purpose: kubectl is a command-line tool that is used to interact with the K8s API server and manage K8s resources such as pods, deployments, and services. On the other hand, kubelet is an agent that runs on each node in the K8s cluster and is responsible for managing the containers running on that node.

  2. Location: kubectl is typically run on a client machine outside of the K8s cluster, while kubelet is run on each node in the K8s cluster.

  3. Functionality: kubectl provides a wide range of functionality for managing K8s resources, including creating, deleting, and updating resources, as well as managing deployments, services, and namespaces. On the other hand, kubelet is primarily responsible for managing containers on a single node, including starting and stopping containers, monitoring container health, and reporting container status to the Control Plane.

  4. User interface: kubectl provides a user-friendly command-line interface (CLI) for managing K8s resources, while kubelet does not have a user interface and is primarily managed by the K8s Control Plane.

πŸš€ Explain the role of the API server.

The API server is a key component of Kubernetes (K8s) that provides the primary interface for managing the K8s cluster. It acts as a central hub that handles all communication between clients, controllers, and other K8s components. Here are the roles of the API server:

  1. Expose the K8s API: The API server exposes the K8s API, which allows users to interact with the K8s cluster and manage K8s resources such as pods, deployments, services, and namespaces.

  2. Authentication and authorization: The API server is responsible for authenticating and authorizing requests made to the K8s API. It supports several authentication methods such as certificates, tokens, and usernames/passwords, and uses role-based access control (RBAC) to control access to K8s resources.

  3. Resource validation and defaulting: The API server performs validation and defaulting of resources before they are stored in etcd, the K8s key-value store. This ensures that resources are correctly formatted and meet the requirements of the K8s API.

  4. Event processing: The API server processes events that are generated by K8s components and resources, such as pod creation or deletion. It then broadcasts these events to other K8s components and clients that have subscribed to them.

  5. Scaling: The API server supports horizontal scaling by allowing multiple instances of the API server to run in parallel. This helps to distribute the load of managing the K8s cluster and ensures high availability.

Happy Learning :)

~Ritul Gupta

Β