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. Java内部类(转发:)

    内部类是指在一个外部类的内部再定义一个类.类名不需要和文件夹相同. 内部类分为: 成员内部类.局部内部类.静态嵌套类.匿名内部类 . 1.成员内部类 成员内部类是最普通的内部类,它的定义为位于另一个类 ...

  2. 使用Imagemagick批量加水印缩小图片的脚本

    安装Imagemagick首先要安装Imagemagick 本文HTML永久地址 doc CentOS上安装 yum install ImageMagick -yDebian上安装 apt-get i ...

  3. (转载)《C#高级编程》读书笔记

    C#类型的取值范围 名称 CTS类型 说明 范围 sbyte System.SByte 8位有符号的整数 -128~127(−27−27~27−127−1) short System.Int16 16 ...

  4. 第五章 python中的异常处理

    每种编程语言都会有自己的异常处理机制,虽然各有特色,但基本上都差不多,那么python中强大异常处理机制是什么样的呢? 一.异常: python用异常对象来表示异常情况,遇到错误后,会引发异常.如果异 ...

  5. python 3 递归调用与二分法

    递归调用与二分法 1.递归调用 递归调用:在调用一个函数的过程中,直接或间接地调用了函数本身. 示例: def age(n): if n == 1: return 18 # 结束条件 return a ...

  6. vim打开多个文件方式及操作

    格式如下: #vim file*.txt 或者 #vim file file2 file3 查看当前编程的是那个文件,在冒号命令行下 :args 命令,类似:file [file2],以中括号里面为当 ...

  7. Havel-Hakimi定理 POJ1659

    对于图的所有顶点,计算出每个顶点的度,度序列.给定一个序列判断序列是否可图. #include<cstdio> #include<algorithm> #include< ...

  8. [Vue] 初识Vue-常用指令

    Vue Vue是一套用于构建用户界面的渐进式框架, Vue的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合.Vue是一个JavaScript MVVM库, 以数据驱动和组件化的思想构 ...

  9. java访问控制---java编程语言

  10. 在线编辑代码[django]版本

    再国内,做什么都这么吃力.连aliyun 的ssh 都被封这是什么世道,所以做一个在线编辑代码的忙忙碌碌有点粗糙.大家见谅​1. [代码]views.py #-*- coding:utf-8 -*-  ...