Kubernetes Architecture

Kubernetes Architecture

What is Kubernetes?

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications. Containers are a lightweight and portable way to package and run applications and their dependencies. Kubernetes provides a framework for automating the deployment and management of containerized applications at scale, making it easier to manage and scale applications in a dynamic and distributed computing environment.

Why do we call it k8s ?

The term "K8s" is a shorthand or abbreviation for Kubernetes. The "8" in "K8s" represents the eight letters between "K" and "s" in the word "Kubernetes." This kind of abbreviation is known as leetspeak, a form of language or code where letters are replaced with numbers or other characters that resemble the letters they replace.

The use of "K8s" is a convenient and widely accepted way to refer to Kubernetes, especially in written communication, documentation, and discussions where brevity is appreciated.

What are the benefits of using k8s?

  1. Container Orchestration: Kubernetes automates the deployment, scaling, and management of containerized applications. It abstracts the underlying infrastructure, allowing developers to focus on building applications without worrying about the intricacies of the deployment environment.
  2. Scalability: Kubernetes makes it easy to scale applications horizontally by adding or removing instances of containers based on demand. This ensures that applications can handle varying levels of traffic and workload.
  3. High Availability: Kubernetes enhances the reliability of applications by distributing containers across multiple nodes in a cluster. If a node or container fails, the system can automatically reschedule and redistribute workloads to healthy nodes, minimizing downtime.
  4. Rolling Updates and Rollbacks: Kubernetes facilitates seamless updates and rollbacks of applications. Deployments can be updated with new container versions without downtime, and if an issue is detected, rolling back to a previous version is straightforward.
  5. Declarative Configuration: Kubernetes uses declarative configuration files (YAML or JSON) to define the desired state of applications and infrastructure. This approach allows for version control of configurations, making it easier to manage and reproduce environments.
  6. Resource Utilization: Kubernetes optimizes resource utilization by efficiently packing containers onto nodes. It can distribute workloads based on available resources and constraints, maximizing the use of computing resources.

Architecture of Kubernetes


  1. Master Node:API Server: Exposes the Kubernetes API and serves as the front end for the Kubernetes control plane.etcd: Consistent and highly available key-value store used for storing configuration data.Controller Manager: Maintains the desired state of the cluster by running controller processes.Scheduler: Assigns work (pod) to nodes based on resource availability and constraints.
  2. Node (Minion) - Worker Node:Kubelet: Agent that runs on each node and ensures that containers are running in a Pod.Container Runtime: Software responsible for running containers (e.g., Docker, containerd).Kube Proxy: Maintains network rules on nodes. It enables communication between pods and external traffic.
  3. Pod:The smallest deployable unit in Kubernetes, representing a single instance of a running process in a cluster.
  4. Controller:Manages the lifecycle of pods and other resources, ensuring the desired state is maintained.
  5. Service:An abstraction that defines a logical set of pods and a policy by which to access them. It provides a stable endpoint for communication.
  6. Volume:Storage abstraction that allows pods to persist data beyond the pod's lifecycle.
  7. Namespace:Virtual clusters within a physical cluster, allowing multiple virtual clusters to coexist in the same physical cluster.
  8. Label:Key-value pairs attached to objects (e.g., pods) for grouping and selecting subsets of objects.
  9. ConfigMap and Secret:Objects for storing configuration data and sensitive information, respectively, separate from application code.
  10. Deployment:High-level construct that manages the deployment of applications, allowing easy updates and rollbacks.

What is Control Plane?

The Control Plane in Kubernetes is the set of components that manage and control the overall state of the cluster. It is responsible for making global decisions about the cluster (e.g., scheduling), as well as detecting and responding to cluster events (e.g., starting up a new pod when a deployment's replicas field is unsatisfied). The main components of the Control Plane include:

  1. API Server: Exposes the Kubernetes API, which is used to interact with the cluster. It processes REST operations, validates them, and updates the corresponding objects in etcd.
  2. etcd: Consistent and highly available key-value store that stores the configuration data of the cluster. It acts as the single source of truth for the cluster's state.
  3. Controller Manager: Manages controllers that regulate the state of the system. Examples include the Replication Controller, which ensures the specified number of replicas for a pod, and the Node Controller, which manages nodes.
  4. Scheduler: Assigns workloads (pods) to nodes based on resource requirements, constraints, and other policies. It helps maintain the desired state of the cluster by distributing workloads effectively.

Write the difference between kubectl and kubelets.

kubectl:

  • Role: Command-line interface for interacting with the Kubernetes cluster.
  • Function: Used by administrators and developers to deploy and manage applications, inspect cluster resources, and perform various cluster operations.
  • Location: Typically run on a user's local machine, outside the Kubernetes cluster.
  • Examples: kubectl get pods, kubectl apply -f deployment.yaml

kubelet:

  • Role: Node agent that runs on each worker node in the cluster.
  • Function: Responsible for maintaining the pods on its node, ensuring they run in the desired state as specified by the control plane.
  • Location: Runs on every node within the Kubernetes cluster.
  • Examples: No direct commands for users; it manages pod lifecycle on the node.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了