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++的模板为泛型程序设计奠定了关键的基础 (二 ...
随机推荐
- SAP ATP邏輯可用性檢查
[转http://tqmeng.blog.163.com/blog/static/169263916201162002414612/]SAP ATP邏輯可用性檢查1.可用性檢查群組OVZ2主要用於檢查 ...
- 从HttpServletRequest获取POST数据的代码
我们经常需要从HttpServletRequest对象获取POST请求的数据,下面给出简练的代码共大家参考 StringBuffer jb = new StringBuffer(); String l ...
- 查看django的安装路径
查看django的安装路径 pip3 show django
- Gateway
网关在传输层上以实现网络互连,是最复杂的网络互连设备,仅用于两个高层协议不同的网络互连.网关的结构也和路由器类似,不同的是互连层.网关既可以用于广域网互连,也可以用于局域网互连. 网关是一种充当转换重 ...
- nginx别名配置,状态配置,include优化
一.nginx帮助参数 下面是关于/application/nginx/sbin/nginx 的参数帮助 [root@A conf]# /application/nginx/sbin/nginx -h ...
- 算法(Algorithms)第4版 练习 1.5.12
package com.qiusongde; import edu.princeton.cs.algs4.StdIn; import edu.princeton.cs.algs4.StdOut; pu ...
- 更改ubuntu主机名称
vim /etc/hostname 将root更改为admin vim /etc/passwd
- 分享知识-快乐自己:Liunx-大数据(Hadoop)初始化环境搭建
大数据初始化环境搭建: 一):大数据(hadoop)初始化环境搭建 二):大数据(hadoop)环境搭建 三):运行wordcount案例 四):揭秘HDFS 五):揭秘MapReduce 六):揭秘 ...
- PHP消息队列用法实例分析
这篇文章主要介绍了PHP消息队列用法,结合实例形式分析了PHP消息队列用于Linux下进程间通信的相关技巧,需要的朋友可以参考下 该消息队列用于linux下,进程通信 队列状态信息:具体参考手册
- selenium-查看selenium API
pydoc是Python自带的模块,主要用于从python模块中自动生成文档,这些文档可以基于文本呈现的.也可以生成WEB 页面的,还可以在服务器上以浏览器的方式呈现! 一.pydoc 1.到底什么是 ...