设为首页 收藏本站
查看: 804|回复: 0

[经验分享] 一只宅男的自我修养

[复制链接]

尚未签到

发表于 2018-1-5 17:00:24 | 显示全部楼层 |阅读模式
  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

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-431958-1-1.html 上篇帖子: [k8s]coredns/kube-dns配置subdomain 下篇帖子: Coding-Job:从研发到生产的容器化融合实践
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表