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组件简介的更多相关文章

  1. k8s的简介以及搭建

    一:简介 1.什么是k8s? k8s是一个docker容器管理工具 它是一个全新的基于容器技术的分布式架构领先方案,是开源的容器集群管理系统. 在docker的基础上,为容器化的应用提供部署运行,资源 ...

  2. k8s 组件介绍__单Master集群部署

    参考链接:https://github.com/opsnull/follow-me-install-kubernetes-cluster kubernetes 概述 1.kubernetes 是什么 ...

  3. Netty 源码(一)Netty 组件简介

    Netty 源码(一)Netty 组件简介 Netty 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) 一.Netty 架构 Core: ...

  4. Kubernetes学习之路(二十)之K8S组件运行原理详解总结

    目录 一.看图说K8S 二.K8S的概念和术语 三.K8S集群组件 1.Master组件 2.Node组件 3.核心附件 四.K8S的网络模型 五.Kubernetes的核心对象详解 1.Pod资源对 ...

  5. amazeui学习笔记二(进阶开发2)--Web组件简介Web Component

    amazeui学习笔记二(进阶开发2)--Web组件简介Web Component 一.总结 1.amaze ui:amaze ui是一个web 组件, 由模板(hbs).样式(LESS).交互(JS ...

  6. 2.第一篇 k8s组件版本及功能简介

    文章转载自:https://mp.weixin.qq.com/s?__biz=MzI1MDgwNzQ1MQ==&mid=2247483772&idx=1&sn=a693d8a9 ...

  7. k8s入门简介

    1.docker的三种编排工具 Docker的第一类编排工具: a.docker compose(docker原生):只能对一个主机上的容器进行编排,无法编排多个主机上的容器; b.docker sw ...

  8. k8s节点简介、移除节点、新增节点

    简介 Node是Pod真正运行的主机,可以是物理机也可以是虚拟机. Node本质上不是Kubernetes来创建的, Kubernetes只是管理Node上的资源. 为了管理Pod,每个Node节点上 ...

  9. [转贴]从零开始学C++之STL(一):STL六大组件简介

    一.STL简介 (一).泛型程序设计 泛型编程(generic programming) 将程序写得尽可能通用 将算法从数据结构中抽象出来,成为通用的 C++的模板为泛型程序设计奠定了关键的基础 (二 ...

随机推荐

  1. C#BackgroundWorker组件

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. python利用wxpy监控微信公众号

    此次利用wxpy可以进行微信公众号的消息推送监测(代码超级简单),这样能进行实时获取链接.但是不光会抓到公众号的消息,好友的消息也会抓到(以后会完善的,毕竟现在能用了,而且做项目的微信号肯定是没有好友 ...

  3. session不能使用 ASP.NET MVC

    在web.coonfig中添加 <sessionState mode=" /> 如: <system.web> //... <sessionState mode ...

  4. c++学习笔记(网上资料)

                                    C++笔记       2007-3-22 1. 程序 —— 可执行文件,人发送给计算机的一组指令.         硬件指令是二进制, ...

  5. 面向对象分析与设计(C++)课堂笔记

    第一次课: 对象是程序设计最基本的单元 对象:对象标识.属性.操作(对象标识又分为内部标识.外部标识) 三三制原则 继承:英文语义”is a kind of” 自动的拥有或隐含的复制 虚基类:解决多继 ...

  6. [原创]java WEB学习笔记35:java WEB 中关于绝对路径 和相对路径问题

    本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...

  7. javascript箭头函数把函数给简写了[0403]

    箭头函数把函数给简写了[0403]        我不是很喜欢箭头函数,总觉得它让原本就不那么严谨的js更加不严谨了,所以有时候看js程序也是一件很头痛的事情,不过在ES6中加入了这么一个新的方法,已 ...

  8. nginx 搭建虚拟主机

    一.排错三部曲 第一步在客户端上ping服务端ip  ping 10.0.0.8 第二部在客户端上telnet服务器端IP.端口  telnet 10.0.0.8 第三部在客户端使用wget命令检测 ...

  9. <软件架构与设计模式>侯捷老师关于Adapter类在STL中的深入解析和模式探讨

    题外话:侯捷老师难得一年就来上九堂课就要会宝岛,特此留念签名赠语及合照以自勉.  学海无涯,为勤是岸 <正文开始> 昨天晚上连上了3个小时的大课探究单单讲了Adapter一个类,幸运的是本 ...

  10. PHP继承中$this的问题

    在父类中的构造函数中使用$this , 这是$this指的是正在实例化的子类对象,不管是parent还是继承调用父类的构造函数. 如: class CompanyController extends ...