This page looks best with JavaScript enabled

Basic Concepts in Kubernetes

 ·  ☕ 4 min read

1. Cluster

1.1 Master

The Master is responsible for managing and maintaining Kubernetes cluster information, dispatching tasks to Nodes, and receiving feedback.

The components running on the Master include kube-apiserver, kube-scheduler, kube-controller-manager, cloud-controller-manager, and so on.

1.2 Node

A Node carries the cluster workload; it can be a physical machine or a virtual machine. To manage Pods, every Node runs a Container Runtime, Kubelet, and Kube-proxy.

2. Core Components

2.1 kube-apiserver

kube-apiserver provides a RESTful API for the Kubernetes cluster and is the only entry point for operating the cluster.

2.2 kube-scheduler

kube-scheduler is responsible for assigning and scheduling Pods onto nodes within the cluster. It watches kube-apiserver, queries the Pods that have not yet been assigned a Node, and then assigns nodes to those Pods according to the scheduling policy.

2.3 kube-controller-manager

kube-controller-manager monitors the state of the entire cluster through the apiserver and ensures that the cluster stays in the expected working state.

2.4 cloud-controller-manager

cloud-controller-manager is mainly responsible for interacting with the underlying cloud provider’s platform.

2.5 kubelet

kubelet runs on Node nodes, registers node information with the apiserver, and periodically reports the node’s resource usage to the Master. In addition, kubelet accepts and executes instructions sent by the Master node, managing Pods and the containers within Pods.

2.6 kube-proxy

kube-proxy runs on Node nodes and is responsible for service communication and load balancing.

2.7 kube-dns

kube-dns provides naming service for Kubernetes.

2.8 kubeadm

kubeadm is a tool for building Kubernetes clusters. The two commands it provides, kubeadm init and kubeadm join, are the best practice for quickly building a Kubernetes cluster. kubeadm only cares about the most basic components of the cluster and does not involve plugins such as dashboard or CNI.

2.9 federation

Kubernetes is designed for a single cluster within the same region. Only network performance within the same region can satisfy Kubernetes’s requirements for scheduling and for compute and storage connectivity.

federation provides cross-cluster resource synchronization and cross-cluster service discovery, and can be used to manage multiple clusters.

2.10 kubectl

kubectl is the command-line tool for Kubernetes.

3. Basic Objects

3.1 Pod

Pod is the most basic scheduling unit in Kubernetes.

A Pod can run multiple Docker containers, and the containers share the PID, IPC, Network, and UTS namespaces. A Pod is assigned an IP address when it is created, and containers within a Pod can communicate with each other.

3.2 Service

Service is used to expose a group of Pods as a service. Because a Pod’s IP changes when the Pod restarts, it cannot directly provide services to the outside. Service provides a unified access entry point for a group of Pods. Kube-proxy performs load balancing across the multiple Pods.

3.3 Label

Labels are attached to objects as key/value pairs and are used to identify Kubernetes objects. Label Selector can be used to select a group of objects with the same Label.

3.4 Replication Controller

Replication Controller is used to ensure that a certain number of Pods are running normally in the cluster. Replication Controller continuously monitors the running state of Pods, and when a Pod fails and the count decreases, it runs new Pod replicas.

3.5 Replica Set

Replica Set is the upgraded version of Replication Controller. Replication Controller only supports equality-based selectors, whereas Replica Set supports the set-based selectors described in the labels user guide.

3.6 Deployment

Deployment is the resource in Kubernetes used to handle stateless services. It provides a way to update Pods and Replica Sets, and integrates functions such as rolling out deployments, rolling upgrades, creating replicas, pausing rollout tasks, resuming rollout tasks, and rolling back to a previous version.

3.7 Job

Job is used to batch-process short-lived one-off tasks and ensures that a specified number of Pods terminate successfully.

3.8 DaemonSet

DaemonSet ensures that all or some of the nodes in the cluster run the same Pod replica; whenever a new node is added to the cluster, the Pod starts on the target node.

3.9 StatefulSet

StatefulSet is the resource used to support stateful services; the Pods it manages have fixed Pod names and a fixed start/stop order.

4. References


WeChat Official Account
WRITTEN BY
WeChat Official Account