-
Notifications
You must be signed in to change notification settings - Fork 0
EN_K8s_Basics
Certainly! Here's the provided information about Kubernetes and container orchestration, translated into English and formatted in a code block:
markdown Copy code
Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and operation of application containers. Developed by Google and now maintained by the Cloud Native Computing Foundation, Kubernetes offers several key advantages:
-
Container Orchestration:
- Efficiently manages the lifecycle of containers, handling deployment, scaling, and termination across machine clusters. This simplifies running applications in containers that are isolated and bundle their own dependencies.
-
Scalability:
- Enables automatic scaling of applications up and down using simple commands, UI, or automatically based on CPU usage.
-
Load Balancing:
- Distributes network traffic to ensure stable deployment, preventing single points of failure in your application.
-
High Availability:
- Ensures application availability through features like automatic bin packing, self-healing, replication, and horizontal scaling.
-
Automated Rollouts and Rollbacks:
- Allows you to define a desired state for deployed containers and change the actual state to the desired state at a controlled rate, including creating new containers, removing existing ones, and replacing all resources.
-
Service Discovery and Load Balancing:
- Exposes containers using DNS names or their IP addresses. If traffic to containers is high, Kubernetes can load balance and distribute network traffic.
-
Storage Orchestration:
- Automatically mounts any storage system, including local storages and public cloud providers.
-
Secret and Configuration Management:
- Manages sensitive information like passwords, OAuth tokens, and SSH keys, allowing you to deploy and update secrets and application configurations without rebuilding container images or exposing secrets in stack configurations.
Container orchestration is the automatic management of the container lifecycle, encompassing a variety of activities such as deployment, scaling, networking, and lifecycle management of containers. In other words, container orchestration refers to the process of constructing tasks of individual components and application layers.
- Efficiency: Manages and scales a large number of containers efficiently.
- Load Balancing: Automatically distributes load and traffic among containers.
- High Availability: Prevents downtime by managing container replicas and replacements.
- Container: A lightweight, standalone executable package that includes everything needed to run software.
- Pod: The smallest deployable unit in Kubernetes that can host one or more containers.
- Node: A worker machine in Kubernetes, which could be either a VM or a physical machine, depending on the cluster.
- Cluster: A set of nodes running containerized applications managed by Kubernetes.
In addition to Kubernetes, there are tools like Docker Swarm and Apache Mesos that also provide orchestration capabilities.
Kubernetes is a system for managing containerized applications across clusters of machines.
It uses a variety of resources and components to handle various aspects of application deployment and management.
Within Kubernetes, the kube-system namespace contains several important system Pods that play important roles in a Kubernetes cluster.
- Responsible for central control of the entire Kubernetes cluster.
- It provides Kubernetes APIs for use by internal system components as well as external users.
- When a Pod is created,
kube-apiserverprocesses requests and stores Pod information in the etcd database.
- A consistent, highly available key-value store that serves as Kubernetes' backing store for all cluster data.
- When a Pod is created, its configuration and state are stored in
etcd, so the cluster state is maintained and can be recovered in the event of a failure.
- It watches for newly created Pods that do not have assigned nodes and selects which nodes to run based on various scheduling criteria, including resource requirements, affinity specifications, data locality, and workload-to-workload.
- After a Pod is created,
kube-schedulerassigns it to the appropriate node.
- Runs a controller process with background threads that handle routine tasks in the cluster.
- When creating a Pod, the relevant controller in
kube-controller-managerchecks whether the actual state of the Pod matches the desired state specified by the user.
- The kubelet running on each node in the cluster is responsible for ensuring that containers are running in Pods.
- When a Pod is scheduled on a node, the kubelet on that node receives a request from
kube-apiserverand starts the container specified in the Pod.
- It runs on each node and is a network proxy, maintaining network rules that allow network communication to Pods from network sessions inside or outside the cluster.
- When a Pod is created,
kube-proxyupdates the node's network rules to allow IP forwarding to the Pod's IP address.
- Provides a DNS service for your Kubernetes cluster, translating service and pod names into IP addresses.
- When a Pod is created, it gets an IP address and DNS name.
CoreDNSupdates records to make Pods accessible via their DNS names within the cluster.
- Container runtime is software responsible for running containers.
- Supports container runtimes such as Containerd and CRI.
-
Addonimplements cluster functions using Kubernetes resources (daemonset, deployment, etc.). - Because it provides cluster-level functionality, the namespace resource for the add-on belongs to the kube-system namespace.
-
kubectl (Execute):
- User executes
kubectl apply -f k8s-deployment.yml. - Converts YAML to JSON and sends to kube-apiserver.
- User executes
-
kube-apiserver (Processing):
- Receives deployment request.
- Stores deployment details in Kubernetes database.
-
etcd (Data Storage):
- Stores configuration and state information.
- Notifies kube-controller-manager when deployment resources are updated.
-
kube-controller-manager (Resource Creation):
- Creates Pod resources based on deployment's replica count.
-
kube-scheduler (Scheduling):
- Monitors unscheduled pods; assesses node health.
- Selects optimal node and updates
nodeNamein Pod spec.
-
kubelet (Node-Level Execution):
- Running on each worker node.
- Checks for and runs containers in assigned pods.
- Executes tasks per control plane instructions.
-
Container Runtime Interface (CRI) Daemon (Container Creation):
- Invoked by kubelet to create containers in the pod.
-
kubelet (Status Update):
- Performs readiness and liveness probes.
- Updates pod status to
runningif checks pass.