Day 30 : Kubernetes Architecture

Day 30 : Kubernetes Architecture

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

    Open source Container Orchestration tool by Google used for multi environment,

    multi-container deployment.

    The name Kubernetes originates from Greek, meaning helmsman or pilot.

    K8s as an abbreviation results from counting the eight letters between the "K" and the "s".

  • What are the benefits of using k8s?

    Kubernetes (K8s) offers several significant benefits:

    1. Orchestration and Automation: Kubernetes automates many aspects of container management, including deployment, scaling, load balancing, and self-healing. This reduces manual intervention, human error, and the time required for operations tasks.

    2. Scalability: K8s can automatically scale applications based on resource usage or predefined criteria, ensuring that applications can handle varying workloads without manual intervention. This helps maintain optimal performance and cost-effectiveness.

    3. High Availability: Kubernetes provides tools for creating highly available applications by distributing workloads across multiple nodes in a cluster. It can detect and recover from node failures, ensuring uninterrupted service availability.

    4. Resource Efficiency: Kubernetes allows fine-grained control over resource allocation and utilization. By defining resource limits and requests for containers, organizations can maximize resource utilization and reduce wastage.

    5. Portability: K8s abstracts away the underlying infrastructure, making applications portable across different cloud providers or on-premises environments. This reduces vendor lock-in and increases flexibility.

    6. Ecosystem and Community: Kubernetes has a vast and active open-source community, which means a wealth of resources, documentation, plugins, and third-party tools are available. This ecosystem can accelerate development and troubleshooting.

    7. Self-Healing: Kubernetes monitors the health of applications and can automatically restart or replace containers that fail. This enhances application reliability and reduces downtime.

    8. Rolling Updates and Rollbacks: Kubernetes supports rolling updates, making it easy to deploy new versions of applications without downtime. If issues are detected, rolling back to a previous version is straightforward.

  • Explain the architecture of Kubernetes

    Components of Kubernetes-

    Master nodes-

    Etcd - Etcd is an open-source distributed key-value store used to hold and manage the critical information that distributed systems need to keep running

    Etcd stores all the information related to pods, nodes, configs, secrets, accounts, rolls, bindings, etc.

    API server - The API server is the central control point for all administrative tasks in the Kubernetes cluster. It exposes the Kubernetes API, which clients use to interact with the cluster. It processes incoming requests, validates them, and updates the corresponding Etcd data store.

    Controller manager - The controller manager is responsible for maintaining the desired state of the cluster. It runs various controllers, such as the Replication Controller and the Deployment Controller, to ensure that the actual state matches the desired state.

    Scheduler - The scheduler is responsible for deciding which node in the cluster should run a new pod (a group of one or more containers). It takes into account factors like resource constraints, node affinity, and anti-affinity rules when making scheduling decisions.

    Worker nodes -

    kubelet - The kubelet is an agent that runs on each node in the cluster. It communicates with the API server and ensures that containers are running as expected. It also reports the node's status and resource usage to the control plane.

    Service proxy (kube proxy)- kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept. kube-proxy maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster.

  • What is Control Plane?

    The control plane is responsible for container orchestration and maintaining the desired state of the cluster. It has the following components.

  • Write the difference between kubectl and kubelets:

    kubectl- The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For more information including a complete list of kubectl operations, see the kubectl reference documentation.

    kubelets- Kubelet is an agent component that runs on every node in the cluster. t does not run as a container instead runs as a daemon, managed by systemd.

    It is responsible for registering worker nodes with the API server and working with the podSpec (Pod specification – YAML or JSON) primarily from the API server. podSpec defines the containers that should run inside the pod, their resources (e.g. CPU and memory limits), and other settings such as environment variables, volumes, and labels. Explain the role of the API server.