kubernetes concepts (一)

Concepts

The Concepts section helps you learn about the parts of the Kubernetes system and the abstractions Kubernetes uses to represent your cluster, and helps you obtain a deeper understanding of how Kubernetes works.node

Overview

To work with Kubernetes, you use Kubernetes API objects to describe your cluster’s desired state: what applications or other workloads you want to run, what container images they use, the number of replicas, what network and disk resources you want to make available, and more. You set your desired state by creating objects using the Kubernetes API, typically via the command-line interface, kubectl. You can also use the Kubernetes API directly to interact with the cluster and set or modify your desired state.api

在K8s中,你能夠運行應用或其餘workloads,應用能夠使用容器鏡像,每一個應用能夠有多個副本(replicas),能夠使用網絡和磁盤資源。kubernetes API能夠用於查詢、配置、修改這些應用的目標狀態,命令行接口爲kubectl。服務器

Once you’ve set your desired state, the Kubernetes Control Plane works to make the cluster’s current state match the desired state. To do so, Kubernetes performs a variety of tasks automatically–such as starting or restarting containers, scaling the number of replicas of a given application, and more. The Kubernetes Control Plane consists of a collection of processes running on your cluster:網絡

  • The Kubernetes Master is a collection of three processes that run on a single node in your cluster, which is designated as the master node. Those processes are: kube-apiserverkube-controller-manager and kube-scheduler.
  • Each individual non-master node in your cluster runs two processes:
    • kubelet, which communicates with the Kubernetes Master.
    • kube-proxy, a network proxy which reflects Kubernetes networking services on each node.

一旦設定好目標狀態,kubernetes control plane會努力使集羣的狀態等於目標狀態。爲了達成這個目標,k8s執行不少自動任務,好比啓動或重啓容器、對某個應用的副本進行擴縮容等等。kubernetes control plane包含不少進程,用於維護和管理整個集羣。app

  • Master節點(物理機)上運行三個進程:kube-apiserver、kube-controller-manager和kube-scheduler
  • 普通節點(物理機)上運行兩個進程:kubelet(與Master節點通訊)、kube-proxy(網絡代理,在每一個節點上轉換kubernetes網絡)

Kubernetes Objects

Kubernetes contains a number of abstractions that represent the state of your system: deployed containerized applications and workloads, their associated network and disk resources, and other information about what your cluster is doing. These abstractions are represented by objects in the Kubernetes API; see the Kubernetes Objects overview for more details.ide

k8s包含了不少抽象,用於描述系統狀態:部署的容器化的應用和workloads、相關網絡和磁盤資源、其餘集羣狀態信息。這些抽象由kubernetes API中的對象表示。oop

The basic Kubernetes objects include:ui

基本的kubernetes對象包括Pod、Service、Volume、Namespace。this

In addition, Kubernetes contains a number of higher-level abstractions called Controllers. Controllers build upon the basic objects, and provide additional functionality and convenience features. They include:spa

另外,kubernetes包含不少抽象層次更高的對象,如控制器。控制器基於基本對象,提供更多功能和特性。控制器包括ReplicaSet、Deployment、StatefulSet、DaemonSet和Job。

Kubernetes Control Plane 控制面

The various parts of the Kubernetes Control Plane, such as the Kubernetes Master and kubelet processes, govern how Kubernetes communicates with your cluster. The Control Plane maintains a record of all of the Kubernetes Objects in the system, and runs continuous control loops to manage those objects’ state. At any given time, the Control Plane’s control loops will respond to changes in the cluster and work to make the actual state of all the objects in the system match the desired state that you provided.

控制面的多個組件共同管理Kubernetes集羣中的通訊,例如kubernetes Master進程和kubelet集成。控制面維護系統中全部對象的記錄,並運行不間斷的控制器循環來管理這些對象的狀態。在任意時間,控制面的控制循環會對集羣中的更改作出相應,並努力將全部對象的實際狀態向用戶設置的目標狀態靠近。

For example, when you use the Kubernetes API to create a Deployment object, you provide a new desired state for the system. The Kubernetes Control Plane records that object creation, and carries out your instructions by starting the required applications and scheduling them to cluster nodes–thus making the cluster’s actual state match the desired state.

例如,當你經過kubernetes API創造一個Deployment對象時,你須要向系統提供一個目標狀態。控制面記錄這個對象的建立,根據你的指令,建立所需的應用並將他們列入集羣節點中,從而將集羣的實際狀態貼合目標狀態。

Kubernetes Master

The Kubernetes master is responsible for maintaining the desired state for your cluster. When you interact with Kubernetes, such as by using the kubectlcommand-line interface, you’re communicating with your cluster’s Kubernetes master.

Kubernetes master負責維護集羣的目標狀態。當你與kubernetes交互時,如使用kubectl 命令行接口,其實是在與kubernetes集羣的kubernetes master進程交互。

The 「master」 refers to a collection of processes managing the cluster state. Typically these processes are all run on a single node in the cluster, and this node is also referred to as the master. The master can also be replicated for availability and redundancy.這裏的master指管理集羣狀態的一些集成。典型狀況這些進程都運行在集羣的一個節點上,這個節點node也被稱爲master節點。

Kubernetes Nodes

The nodes in a cluster are the machines (VMs, physical servers, etc) that run your applications and cloud workflows. The Kubernetes master controls each node; you’ll rarely interact with nodes directly.

kubernetes集羣中的節點就是能夠運行應用和cloud workflows的機器,如VM,物理服務器等。kubernetes master控制每一個節點,用戶不多與這些節點直接交互。

Object Metadata

What’s next

相關文章
相關標籤/搜索