3 introduction to kubernetes

17
Introduction to Kubernetes

Upload: jiang-shang

Post on 16-Jul-2015

446 views

Category:

Software


9 download

TRANSCRIPT

Page 1: 3 introduction to kubernetes

Introduction to Kubernetes

Page 2: 3 introduction to kubernetes

[root@~]# whoami

杨章显[email protected]系统运维工程师热衷于云计算,自动化运维,关注Go、Docker、Kubernetes等技术

Page 3: 3 introduction to kubernetes

What’s Kubernetes

• 开源容器集群管理工具

• 轻量、简单

• 适用度广

• 可扩展

• 自我修复

Page 4: 3 introduction to kubernetes

Key Concepts

• Pod

Docker容器的集合, 可以通过Kubernetes创建、调度、管理

• BoundPod

运行在主机上的容器集合

Page 5: 3 introduction to kubernetes

Key Concepts (cont)

• Replication ControllerPod的集合Replicas副本确保任何时候指定数量Pod在运行管理Pod的生命周期

Page 6: 3 introduction to kubernetes

Key Concepts (cont)

• Services一系列Pod的单一访问portal服务IP服务端口负载均衡器

Page 7: 3 introduction to kubernetes

Key Concepts (cont)

• Labels/Selector键值对用于管理和选择一组对象

Page 8: 3 introduction to kubernetes

Kubernetes Architecture

kubecfg

API server

Minion

Minion

etcd

Kubelet Proxy

Podcontainer

Podcontainer

Page 9: 3 introduction to kubernetes

API Server

• REST Storage• Minion registry• Pod registry• Controller registry• Service registry• Endpoint registry• Event registry• Binding registry• Etcd registry

kubecfg

API server

Pod registry

Controller registry

Services registry

Binding registry

Endpoints registry

Event registry

Etcdregistry

Minion registry

Scheduler Client

Page 10: 3 introduction to kubernetes

API Server(Cont)

• Client定义了操作Pod、Service、ReplicationControllers、Endpoint、Event、Minion的操作

• Controller Manager周期性地同步ReplicationControllers信息,确保集群中任何时候指定数量的Pod在运行周期性地同步Service endpoint信息周期性地从Cloudprovider同步minion信息或者创建minion

Page 11: 3 introduction to kubernetes

• Etcd

分布式高可用一致键值存储,用于存储Kubernetes REST对象配置信息

• Scheduler

实时监测集群中已调度的Pod和未调度的Pod以及集群中的Minion

调度评估策略:Host端口冲突、已请求资源(内存、CPU),volume冲突(GCE persistence disk)、节点selector

写Binding(PodID、Host)到API server,转换Pod为BoundPod并填充访问服务的环境变量

API Server(Cont)

Page 12: 3 introduction to kubernetes

Kubelet

• Docker daemon

• Etcd Client

• go-dockerclientKubernetes调用go-dockerclient封装一系列操作Docker方法,如启动、删除、创建等

• Kubelet监测来自file、etcd、http的Pod配置信息,如果配置发生变化,kubelet进行状态同步主要操作:设置环境变量、绑定Volume和Port、启动Container、杀死Container、删除Container等

Page 13: 3 introduction to kubernetes

Proxy

• 通过etcd客户端监测services和endpoints的变化

• 新增加服务,然后服务处于监听状态,并初始化iptables规则;删除服务,Proxy移除该服务的监听及iptables规则

• 新增加endpoint, 注册endpoint以便Loadbalancer选择,反之移除endpoint

• Loadbalancer通过roundrobin选择一个endpoint提供服务

Page 14: 3 introduction to kubernetes

Proxy(Cont)

Page 15: 3 introduction to kubernetes

Demo

Page 16: 3 introduction to kubernetes

• cAdvisor

https://github.com/google/cadvisor

• Heapster

https://github.com/GoogleCloudPlatform/heapster

• Openvswitch/Fannel/Socketplane

http://openvswitch.org/

https://github.com/coreos/flannel

https://github.com/socketplane/socketplane

Kubernetes ecosystem

Page 17: 3 introduction to kubernetes

T H A N K Y O U