Architecture
Kubernetes, originally sourced from Google's in-house tool Borg, offers a container-centric, application-oriented cluster deployment, and management system. Its ultimate goal is to alleviate the burdensome orchestration of physical/virtual computing, networking, and storage infrastructure, allowing app operators and developers to focus fully on self-operation with container-centric primitives. Furthermore, Kubernetes offers a stable and compatible platform for crafting custom workflows and advanced automation tasks. Impressively, it possesses robust cluster management capabilities, including multilevel security defenses and admission mechanisms, support for multi-tenant apps, transparent service registration and discovery mechanisms, built-in load balancers, fault detection and self-repair mechanisms, service rolling upgrades and online expansion, scalable automatic resource scheduling mechanisms and multi-granularity resource quota management capabilities. Besides, Kubernetes features a comprehensive suite of management tools, covering the entire course of development, deployment testing, and operational monitoring.
An Introduction to Borg
Borg serves as Google's internal large-scale cluster management system, handling the scheduling and management of many of Google's core services. Borg aims to let users put aside resource management concerns, allowing them to concentrate on their primary businesses while maximizing resource use across multiple data centers.
The Borg system mainly consists of BorgMaster, Borglet, borgcfg, and Scheduler, as shown in the following diagram
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-80d9919c70df582d121d5f87cddc463fcf478e82%252Fborg%2520%284%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5ed3540b&sv=1)
BorgMaster is the brain of the whole cluster, maintaining the overall cluster status and persisting data into Paxos storage;
The Scheduler is responsible for task scheduling, assigning specific tasks to specific machines based on application characteristics;
Borglet is tasked with the actual running of tasks (in containers);
borgcfg is Borg’s command-line tool for interacting with the Borg system, usually by submitting tasks through a configuration file.
Kubernetes Architecture
Bringing Borg's design philosophy into play, including concepts such as Pod, Service, Labels, and single Pod single IP, the overall architecture of Kubernetes is strikingly similar to Borg's, as can be seen in the picture below
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-0ee8bceb43ee5ff3d8aa9545d5889340b82202bc%252Farchitecture%2520%285%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=3120427c&sv=1)
Kubernetes mainly comprises the following core components:
etcd stores the whole cluster's state;
kube-apiserver offers a unique entry for resource operations, and supplies authentication, authorization, access control, API registration, and discovery mechanisms;
kube-controller-manager is tasked with maintaining the cluster's state, handling tasks like fault detection, automatic expansion, rolling updates, etc.;
kube-scheduler is responsible for resource scheduling, allocating Pods to respective machines following predetermined scheduling strategies;
kubelet is in charge of container lifecycle maintenance, along with Volume (CVI) and network (CNI) management;
Container runtime handles image management and the actual running of Pods and containers (CRI), with Docker being the default container runtime;
kube-proxy provides service discovery and load balancing within the cluster for Service entities;
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-b2bcdccbc97b9d0698a5c772eff342380536f1fa%252Fcomponents%2520%286%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=f89c88c4&sv=1)
Other than core components, there are some recommended add-ons:
kube-dns provides the entire cluster with DNS services
Ingress Controller provides external entrances for services
Heapster offers resource monitoring
Dashboard provides GUI
Federation provides clusters that span availability zones
Fluentd-elasticsearch provides cluster log collection, storage, and query
Layered Architecture
Kubernetes' design principles and functions mirror a Linux-style layered architecture, as the diagram below depicts
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-a5b00a4ed34f26eb6f2d560c08ec5ff37d7c6b7e%252F14937095836427%2520%284%29.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=67e25309&sv=1)
Core layer: Kubernetes offers core functions, providing an API for building higher-level applications externally and offering a plugin-style application execution environment internally.
Application layer: Includes deployment (stateless applications, stateful applications, batch processing tasks, cluster applications, etc.) and routing (service discovery, DNS resolution, etc.)
Management layer: Measures system metrics (such as infrastructure, containers, and network metrics), enhances automation (like automatic scaling, dynamic provisioning, etc.), and manages policies (like RBAC, Quota, PSP, NetworkPolicy, etc.)
Interface layer: Includes the kubectl command-line tool, client SDK, and cluster federation.
Ecosystem: Above the interface layer lies a vast ecosystem of container cluster management scheduling, divisible into two realms:
External to Kubernetes: Logging, monitoring, configuration management, CI, CD, workflow, FaaS, OTS applications, ChatOps, etc.
Internal to Kubernetes: CRI, CNI, CVI, image repositories, Cloud Provider, cluster's configuration and management, etc.
Core Components
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-e79e660e4e46d70805f3de0902fbb373e87cf506%252Fcore-packages.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=da30d923&sv=1)
Core API
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-f3f84293ded3ae6dc5c13c99d6f0d5496e391332%252Fcore-apis%2520%284%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c1ac6b2&sv=1)
Ecosystem
![](https://kubernetes.feisky.xyz/~gitbook/image?url=https%3A%2F%2F4011040894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LDAOok5ngY4pc1lEDes-1972196547%252Fuploads%252Fgit-blob-923672fb5524e8b6e345b864e82844f8ede8deba%252Fcore-ecosystem%2520%283%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=fb28b0b9&sv=1)
For more information on the layered architecture, be sure to look into the Kubernetes architectural roadmap that the Kubernetes community is currently promoting.
References
最后更新于