Managing Kubernetes from Python using Kube

Post on 24-Jan-2017

83 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

Transcript

Managing Kubernetesfrom Python with Kube

Dave Charles@cobecto

Benefits

Benefits

Downsides?

Kubernetes

K8s

MASTER

NODE NODE NODE

CLUSTER

MASTER

ETCDAPI

SERVERCONTROLLER

MANAGER SCHEDULER

MASTER

ETCDAPI

SERVERCONTROLLER

MANAGER SCHEDULER

Distributed key value store: K8s

STATE

MASTER

ETCDAPI

SERVERCONTROLLER

MANAGER SCHEDULER

ReST API through which all K8s components

interact

MASTER

ETCDAPI

SERVERCONTROLLER

MANAGER SCHEDULER

Runs controllers that drive K8s state towards specification

MASTER

ETCDAPI

SERVERCONTROLLER

MANAGER SCHEDULER

Applies policies to allocate work

across the cluster

NODE

DOCKER KUBELET PROXY

NODE

Container runtime

DOCKER KUBELET PROXY

NODE

Communicates with master to

facilitate container

orchestration

DOCKER KUBELET PROXY

NODE

Networking magic, reflects

services defined

DOCKER KUBELET PROXY

NODE

MASTER

POD 1

container1

container2

POD 2

container3

NODEPOD 1

container1

container2

NODEPOD 2

container3

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registry

APICLIENT

UI

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registrykubectl run nginx:v1

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registrykubectl run nginx:v1

status

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registry

status

status

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

registry

• NAMESPACE• Provides multiple virtual clusters backed by

the same physical cluster• “default” by, well, default

Some Terminology

• POD• Encapsulate containers and volumes• Atomic unit of replication and placement• A logical host

Some Terminology

• Replication Controllers• Ensure n copies of a POD• Will drive current state towards desired state• If too few replicas, will create new ones• If too many, will destroy some• Used for scaling up, down and rolling

updates

Some Terminology

• Services• Targets group of pods with label selectors• Pods get their own IP, but they cannot be

relied upon to be stable over time• Services provide a stable endpoint so that

ephemeral pods can be found and accessed.

Some Terminology

https://bitbucket.org/cobeio/kube

http://python-kube.readthedocs.io/en/latest/

https://github.com/davecharles/kube_workshop

https://www.infoq.com/presentations/7-sins-microservices

http://martinfowler.com/articles/microservices.html

https://www.nginx.com/blog/microservices-at-netflix-architectural-best-practices/

https://bitbucket.org/cobeio/kube

top related