Kubernetes概念学习

文本主要解析Kubernetes的核心概念,参考原文https://kubernetes.io/docs/concepts/

关于Kubernetes的几个原则

The Kubernetes Master is a collection of three processes that run on a single node in your cluster, which is designated as the master node. Those processes are: kube-apiserverkube-controller-manager and kube-scheduler.

Kubernetes Master就是一个跑了kube-apiserver、kube-controller-manager、kube-scheduler三个进程的一个节点,也叫master节点。

Control Plane components can be run on any machine in the cluster. However, for simplicity, set up scripts typically start all Control Plane components on the same machine, and do not run user containers on this machine. 

master节点并不是固定的,其实是约定俗成的只在一个节点上运行所有的非用户态的容器,这个节点就成为master节点。理论上也可以当做一个正常的节点来跑用户的应用容器,只是大家都默认不会这么去做。为了高可用性,etcd也可以跟master节点不部署在一起。

The master can also be replicated for availability and redundancy.

master节点也可以是多个节点组成的集群,来保证高可用和容灾。

Each individual non-master node in your cluster runs two processes:

  • kubelet, which communicates with the Kubernetes Master.
  • kube-proxy, a network proxy which reflects Kubernetes networking services on each node

每个非master的普通节点上,都会运行两个进程,kubelet和kube-proxy,kubelet是用来跟master节点通信,kube-proxy是一个网络代理,表示每个节点上的网络服务。

The Kubernetes master controls each node; you’ll rarely interact with nodes directly

用户很少会直接操控普通节点,一般都是通过master节点通信。

Kubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, logging, and monitoring

Kubernetes不能等同于PaaS,因为Kubernetes是操作在容器之上的,所以能提供跟PaaS很多共通的特性,比如部署、扩缩容、负载均衡、日志和监控等。

关于使用Kubernetes的几个“不”:

Does not limit the types of applications supported. If an application can run in a container, it should run great on Kubernetes.

不限制在Kubernetes中部署的应用类型,即只要可以在容器中运行的应用,则都可以在Kubernetes中运行。

Does not deploy source code and does not build your application.

不提供对源代码的部署和不支持构建应用。这些工作由用户自己根据各自的场景和技术要求自行解决。

Does not provide application-level services, such as middleware (for example, message buses), data-processing frameworks (for example, Spark), databases (for example, MySQL), caches, nor cluster storage systems (for example, Ceph) as built-in services. 

不提供应用级别的服务,比如中间件(消息)、数据处理(spark)等作为内置服务,如有需要,可以自行在Kubernetes上运行这些应用,也可以通过open service broken api来获取。

Does not dictate logging, monitoring, or alerting solutions.

不强制指定日志、监控或者报警的解决方案。会提供一些集成的概念和机制来收集metric。

Does not provide nor mandate a configuration language/system (for example, Jsonnet). 

不提供也不授权任意的配置语言或者配置系统

Does not provide nor adopt any comprehensive machine configuration, maintenance, management, or self-healing systems.

不提供也不采用任何其他的机器配置、运维管理、自愈系统等。

Kubernetes is not a mere orchestration system. In fact, it eliminates the need for orchestration

Kubernetes不仅仅只是个编排系统,实际上,Kubernetes是消除了编排的需求,让用户不用关心编排的过程,只要知道Kubernetes可以实现用户想到达到的效果即可,中间的过程都是不用关心的。

服务端组件

Kube-apiserver

kube-apiserver是Kubernetes管控服务的入口,是可扩展的,可以同时部署多个实例,然后通过slb来负载均衡。

etcd

etcd一个连续的高可用的key-value存储,作为Kubernetes的集群元数据存储。高可用的手段有两个:内置快照和多实例分布式集群部署。

kube-scheduler

负责监听新建的pod分配到非指定的节点上去。

kube-controle-manager

Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.

理论上,每一个controller都是一个单独的进程,简化后,所有的controller可以被编译成一个二进制文件,跑在一个进程中。这些可以被打包在一起的controller有:

节点controller:负责监听和回应节点挂掉的情况。

副本controller:负责保证每个pod的副本数。

endpoints controller:负责操控endpoint,比如连接服务或者pod

服务的账号和token controller:负责为新的命名空间创建账号、分配可访问API的token。

客户端组件

kubelet

kubelet集群中每个节点上运行的agent,通过一系列的PodSpecs保障pod上的所有容器都是按照预期在正常运行,对于不是由当前Kubernetes集群创建的容器,kubelet不会去管理。

kube-proxy

kube-proxy是集群中每个节点上运行的网络代理,维护集群内外与pod的网络接连情况。kube-proxy会优先启用操作系统上的包过滤层,如果操作系统没有这个设置,则会使用自己的流量控制机器。

container runtime

主要是负责管理运行的容器,通用的容器运行时有docker,containerd,CRI-O,或者其他任意CRI的实现。

附件

附件是利用Kubernetes资源(比如DaemonSet,DeploymentSet)实现集群的有关特性。因为这些附件可以扩展集群维度的特性,所以这些附件的命名空间资源属于kube-system级别的命名空间。以下是一些主要的附件:

DNS

所有的Kubernetes集群都应该有DNS,因为很多功能都依赖这个附件。DNS是指DNS服务,为Kubernetes服务提供DNS记录。

Web UI(Dashboard)

管理Kubernetes集群,用户可以管控、运维集群中运行的应用。

container resource monitoring

以时间为维度,将容器的数据上报存储到中央仓库,然后通过管控平台展示出来。

Cluster-level logging

将容器的日志传输到中央日志存储系统,api可以使用这些数据来查看、搜索日志。

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值