k8s组件简介
Kubernetes is constructed using several components, as follows:
f Kubernetes master
f Kubernetes nodes
f etcd
f Overlay network (flannel)
These components are connected via network, as shown in the following screenshot:
The preceding image can be summarized as follows:
f Kubernetes master connects to etcd via HTTP or HTTPS to store the data. It also
connects flannel to access the container application.
f Kubernetes nodes connect to the Kubernetes master via HTTP or HTTPS to get a
command and report the status.
f Kubernetes nodes use an overlay network (for example, flannel) to make a
connection of their container applications.
How to do it…
In this section, we are going to explain the features of Kubernetes master and nodes;
both of them realize the main functions of the Kubernetes system.
Kubernetes master
Kubernetes master is the main component of Kubernetes cluster. It serves several
functionalities, such as the following items:
f Authorization and authentication
f RESTful API entry point
Chapter 1
3
f Container deployment scheduler to the Kubernetes nodes
f Scaling and replicating the controller
f Read and store the configuration
f Command Line Interface
The next image shows how master daemons worked together to fulfill the mentioned
functionalities:
There are several daemon processes that make the Kubernetes master's functionality, such
as kube-apiserver, kube-scheduler, and kube-controller-manager. Hypercube wrapper
launched all of them.
In addition, the Kubernetes Command Line Interface kubectl can control the Kubernetes
master functionality.
API server (kube-apiserver)
The API server provides an HTTP- or HTTPS-based RESTful API, which is the hub between
Kubernetes components, such as kubectl, scheduler, replication controller, etcd datastore,
and kubelet and kube-proxy, which runs on Kubernetes nodes and so on.
Scheduler (kube-scheduler)
Scheduler helps to choose which container runs by which nodes. It is a simple algorithm that
defines the priority to dispatch and bind containers to nodes, for example:
f CPU
f Memory
f How many containers are running?
Building Your Own Kubernetes
4
Controller manager (kube-controller-manager)
Controller manager performs cluster operations. For example:
f Manages Kubernetes nodes
f Creates and updates the Kubernetes internal information
f Attempts to change the current status to the desired status
Command Line Interface (kubectl)
After you install Kubernetes master, you can use the Kubernetes Command Line Interface
kubectl to control the Kubernetes cluster. For example, kubectl get cs returns the status
of each component. Also, kubectl get nodes returns a list of Kubernetes nodes:
//see the ComponentStatuses
# kubectl get cs
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok nil
scheduler Healthy ok nil
etcd-0 Healthy {"health": "true"} nil
//see the nodes
# kubectl get nodes
NAME LABELS STATUS AGE
kub-node1 kubernetes.io/hostname=kub-node1 Ready 26d
kub-node2 kubernetes.io/hostname=kub-node2 Ready 26d
Kubernetes node
Kubernetes node is a slave node in the Kubernetes cluster. It is controlled by Kubernetes
master to run the container application using Docker ( http://docker.com ) or rkt
( http://coreos.com/rkt/docs/latest/ ) in this book; we will use the Docker
container runtime as the default engine.
Node or slave?
The terminology of slave is used in the computer industry to represent the
cluster worker node; however, it is also associated with discrimination. The
Kubernetes project uses node instead.
Chapter 1
5
The following image displays the role and tasks of daemon processes in node:
Node also has multiple daemon processes, named kubelet and kube-proxy, to support
its functionalities.
kubelet
kubelet is the main process on Kubernetes node that communicates with Kubernetes master
to handle the following operations:
f Periodically access the API Controller to check and report
f Perform container operations
f Runs the HTTP server to provide simple APIs
Proxy (kube-proxy)
Proxy handles the network proxy and load balancer for each container. It performs to change
the Linux iptables rules (nat table) to control TCP and UDP packets across the containers.
After starting the kube-proxy daemon, it will configure iptables rules; you can see
iptables -t nat -L or iptables -t nat -S to check the nat table rules, as follows:
//the result will be vary and dynamically changed by kube-proxy
# sudo iptables -t nat -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-N DOCKER
-N FLANNEL
-N KUBE-NODEPORT-CONTAINER
-N KUBE-NODEPORT-HOST
-N KUBE-PORTALS-CONTAINER
-N KUBE-PORTALS-HOST
Building Your Own Kubernetes
6
-A PREROUTING -m comment --comment "handle ClusterIPs; NOTE: this must be
before the NodePort rules" -j KUBE-PORTALS-CONTAINER
-A PREROUTING -m addrtype --dst-type LOCAL -m comment --comment "handle
service NodePorts; NOTE: this must be the last rule in the chain" -j
KUBE-NODEPORT-CONTAINER
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT -m comment --comment "handle ClusterIPs; NOTE: this must be
before the NodePort rules" -j KUBE-PORTALS-HOST
-A OUTPUT -m addrtype --dst-type LOCAL -m comment --comment "handle
service NodePorts; NOTE: this must be the last rule in the chain" -j
KUBE-NODEPORT-HOST
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 192.168.90.0/24 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 192.168.0.0/16 -j FLANNEL
-A FLANNEL -d 192.168.0.0/16 -j ACCEPT
-A FLANNEL ! -d 224.0.0.0/4 -j MASQUERADE
k8s组件简介的更多相关文章
- k8s的简介以及搭建
一:简介 1.什么是k8s? k8s是一个docker容器管理工具 它是一个全新的基于容器技术的分布式架构领先方案,是开源的容器集群管理系统. 在docker的基础上,为容器化的应用提供部署运行,资源 ...
- k8s 组件介绍__单Master集群部署
参考链接:https://github.com/opsnull/follow-me-install-kubernetes-cluster kubernetes 概述 1.kubernetes 是什么 ...
- Netty 源码(一)Netty 组件简介
Netty 源码(一)Netty 组件简介 Netty 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) 一.Netty 架构 Core: ...
- Kubernetes学习之路(二十)之K8S组件运行原理详解总结
目录 一.看图说K8S 二.K8S的概念和术语 三.K8S集群组件 1.Master组件 2.Node组件 3.核心附件 四.K8S的网络模型 五.Kubernetes的核心对象详解 1.Pod资源对 ...
- amazeui学习笔记二(进阶开发2)--Web组件简介Web Component
amazeui学习笔记二(进阶开发2)--Web组件简介Web Component 一.总结 1.amaze ui:amaze ui是一个web 组件, 由模板(hbs).样式(LESS).交互(JS ...
- 2.第一篇 k8s组件版本及功能简介
文章转载自:https://mp.weixin.qq.com/s?__biz=MzI1MDgwNzQ1MQ==&mid=2247483772&idx=1&sn=a693d8a9 ...
- k8s入门简介
1.docker的三种编排工具 Docker的第一类编排工具: a.docker compose(docker原生):只能对一个主机上的容器进行编排,无法编排多个主机上的容器; b.docker sw ...
- k8s节点简介、移除节点、新增节点
简介 Node是Pod真正运行的主机,可以是物理机也可以是虚拟机. Node本质上不是Kubernetes来创建的, Kubernetes只是管理Node上的资源. 为了管理Pod,每个Node节点上 ...
- [转贴]从零开始学C++之STL(一):STL六大组件简介
一.STL简介 (一).泛型程序设计 泛型编程(generic programming) 将程序写得尽可能通用 将算法从数据结构中抽象出来,成为通用的 C++的模板为泛型程序设计奠定了关键的基础 (二 ...
随机推荐
- chorme 插件
json-handle: json可视化工具 开发中需要用到json,在浏览器显示的json非常乱,难以理解.有没有让人一目了然的工具,让json看起来非常直观呢,json-handle随之而出,包含 ...
- js 实现滑块效果
var dd = $(".drag_bott").removeAttr('id').last().attr('id','drag_bott'); var drag = docume ...
- Python 3 接口与归一化设计
一.接口与归一化设计: 1.归一化让使用者无需关心对象的类是什么,只需要知道这些对象都具备某些功能就可以了,这极大地降低了使用者的使用难度. 2.归一化使得高层的外部使用者可以不加区分的处理所有接口兼 ...
- css判断iphoneX、iphoneXs、iphoneXs Max、iphone XR
//iphoneX.iphoneXs @media only screen and (device-width: 375px) and (device-height: 812px) and (-web ...
- JAVA事件监听机制与实现
事件监听机制的实现:参考图:事件模型_ActionEvent 为了节省资源,系统无法对某个事件进行实时的监听.故实现的机制是当发生某个事件后,处理代码将被自动运行,类似钩子一般.(回调函数) 事件有许 ...
- 添加linux开机启动任务
对于系统里面设置的开机启动程序 先来看一个例子nginx启动脚本 #!/bin/sh ### BEGIN INIT INFO # Provides: nginx # Required-Start: $ ...
- 手撸IoC
Ioc的实现 可以把IoC模式看作是工厂模式的升华,可以把IoC看作一个大工厂,只不过这个大工厂里要生成的对象都是XML文件中给出定义的,然后利用Java的反射变成,根据XML中给出的类名生成相应的对 ...
- ML一(概念学习和一般到特殊序)
概念学习和一般到特殊序 Concept Learning and the General-To-Specific Ordering 1 简介 1.1 定义 概念学习(Concept Learning) ...
- Storm- 使用Storm实现词频汇总
需求:读取指定目录的数据,并实现单词计数的功能 实现方案: Spout来读取指定目录的数据,作为后续Bolt处理的input 使用一个Bolt把input 的数据,切割分开,我们按照逗号进分割 使用一 ...
- node 渲染html模板配置
node 渲染html模板配置 安装swig模块 npm install swig--save - dev 加载swig模块 var swig = require('swig'); 模板配置 //第一 ...