Technology Sharing

How Kubernetes (k8s) architecture works

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Kubernetes Overview

  • Kubernetes(k8s): A container orchestration system open sourced by Google.
  • Origin of the name: Kubernetes is a long word, and the middle 8 letters are usually omitted, abbreviated as k8s.
  • It sits between application services and servers, coordinating and managing multiple application services through policies.
  • Through YAML file configuration, automatic deployment, automatic restart, and automatic expansion and contraction of applications can be achieved.

Kubernetes Architecture

  • Control Plane: It is equivalent to the brain of the cluster, responsible for managing and controlling working nodes.

    • Components include:
      • API Server: Provides an API interface for operating service resources.
      • Scheduler: Responsible for resource scheduling decisions.
      • Controller Manager: Responsible for the creation and closing of application services.
      • etcd: As the storage layer, it saves cluster status and data.
  • Worker Node: It is equivalent to the hands and feet of the cluster, responsible for executing tasks and running application services.

    • Components include:
      • Pod: A running instance of a container, the smallest scheduling unit in k8s.
      • Kubelet: Responsible for the lifecycle management of Pod.
      • Container Runtime: Responsible for the lifecycle management of containers, such as Docker.
      • Kube Proxy: Responsible for Node's network proxy and request forwarding.

Kubernetes Core Concepts

  • Cluster: Consists of a control plane and multiple working nodes.
  • Container Image: A packaged file containing application code and dependent environments.
  • Container: The running unit of the application service.
  • Pod: A collection of one or more containers that share network and storage resources.

Kubernetes Operations Tools

  • kubectl: A command line tool provided by k8s, used to interact with the k8s API to simplify service deployment and management.

Service deployment and calling process

  • Deployment Service: Deploy services by writing YAML files and executing kubectl commands.
  • Service Call: External requests enter the cluster through the Ingress controller and are forwarded to the corresponding Pod by Kube Proxy.

Kubernetes Advantages

  • Automatic deployment, restart, and scaling.
  • Simplify the deployment and operation and maintenance process of services.
  • Supports the management of large-scale container services.

Summarize

  • k8s is a powerful container orchestration tool that realizes the automated management and scheduling of application services through the collaboration of the control plane and worker nodes.
  • The control plane is responsible for decision-making and issuing instructions, while the working nodes are responsible for executing tasks and running applications.
  • Through the kubectl tool, users can easily interact with the k8s API to achieve rapid deployment and management of services.

question

  • What is the relationship between Docker and k8s?