99
Introduce Kubernetes Made by Yongbok Kim (ruo91) # 001 2015.09.0 5 Language: Korean

Introduce Google Kubernetes

Embed Size (px)

Citation preview

Page 1: Introduce Google Kubernetes

Introduce KubernetesMade by Yongbok Kim (ruo91)

# 0012015.09.05

Language: Ko-rean

Page 2: Introduce Google Kubernetes

What is Kubernetes?

Linux Container 를 관리 하기 편하도록

# 002

Page 3: Introduce Google Kubernetes

What is Kubernetes?

Linux Container 를 관리 하기 편하도록

구글이 만든 오픈소스 !

# 003

Page 4: Introduce Google Kubernetes

What is Kubernetes?

Linux Container 를 관리 하기 편하도록

구글이 만든 오픈소스 !

CaaS(Container as a Service)!

# 004

Page 5: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 005

Page 6: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 006

Page 7: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 007

Page 8: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 008

koo-ber-net-ees

Page 9: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 009

koo-ber-net-ees쿠버네티스

Page 10: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 010

koo-ber-net-ees쿠버네티스

혹은

Page 11: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 011

koo-ber-net-ees쿠버네티스

혹은

k-eights

Page 12: Introduce Google Kubernetes

What is Kubernetes?그럼 어떻게 발음하나요 ?

# 012

koo-ber-net-ees쿠버네티스

혹은

k-eights케이에잇츠

Page 13: Introduce Google Kubernetes

What is Kubernetes? # 013

그냥 ...

Page 14: Introduce Google Kubernetes

What is Kubernetes? # 014

그냥 ...

‘ 쿠버네티스’로 합시다 !

Page 15: Introduce Google Kubernetes

왜 만들었어요 ? # 015

구글 규모만 봐도 답 나오죠 .

Page 16: Introduce Google Kubernetes

왜 만들었어요 ? # 016

구글 규모만 봐도 답 나오죠 .

관리 할 것이 많아서요 !

Page 17: Introduce Google Kubernetes

왜 만들었어요 ? # 017

그래서 구글은

Page 18: Introduce Google Kubernetes

왜 만들었어요 ? # 018

그래서 구글은

Large Scale,

Page 19: Introduce Google Kubernetes

왜 만들었어요 ? # 019

그래서 구글은

Large Scale, High Availability

Page 20: Introduce Google Kubernetes

왜 만들었어요 ? # 020

그래서 구글은

Large Scale, High Availability, Batch Job

Page 21: Introduce Google Kubernetes

왜 만들었어요 ? # 021

그래서 구글은

Large Scale, High Availability, Batch Job

환경을 위해

Page 22: Introduce Google Kubernetes

왜 만들었어요 ? # 022

그래서 구글은

Large Scale, High Availability, Batch Job

환경을 위해

Borg 라는 프로젝트를 진행하게 됩니다 .

Page 23: Introduce Google Kubernetes

왜 만들었어요 ? # 023

Borg 관련 논문http://research.google.com/pubs/pub43438.html

Page 24: Introduce Google Kubernetes

왜 만들었어요 ? # 024

다년간 Borg 를 통해 배운 운영 노하우를

Kubernetes 에 녹여 만들었고

2014 년 5~6 월 경에

오픈 소스로 발표 하게 된 것 입니다 .

Page 25: Introduce Google Kubernetes

왜 만들었어요 ? # 025

굳이 .. 오픈 한 이유를 따지자면

우린 이렇게 자랑 할거다 ?( 늬들도 써봐 ! 좋아 !)

그래서 오픈 소스로 오픈 한다 !이런 이유 일듯 .. 개인적인 생각 입니다 .

Page 26: Introduce Google Kubernetes

어떻게 구성이 되어있죠 ? # 026

Kubernetes 는 Master, Minion, Key/Value 저장소로 나뉩니다 .각각의 역할을 살펴 보도록 하겠습니다 .1. Master 1.1 API Server Master 의 중심이 되는 것이 API 서버이며 , 인증 및 Pods, Services, Replication Control 등등의 역할을 담당 합니다 .

1.2 Scheduler kubectl 명령어를 통해 지시 받은 작업을 스케줄러가 이를 가지고 있다가 API 서버로 보내주는 역할을 합니다 .

1.3 Controller Manager (Replication Controller) Pods 의 Replication 부분을 모니터링하고 , 여기에 변경 사항이 있으면 API Server 를 통해 Pods 의 증감 / 감소 설정을 하는 역할을 담당 합니다 . 예를 들어 Pods 의 replicas 수가 10 일 경우 9 개가 되면 자동으로 10 개를 맞춰 주고 , 11 개 이상이 되면 하나를 죽이고 , 지정 된 만큼의 수를 지키게 합니다 .

Page 27: Introduce Google Kubernetes

어떻게 구성이 되어있죠 ? # 027

2. MinionMinion = Server 또는 Node 라고 이해 하면 됩니다 .

2.1 Docker LXC(LinuX Containers) 를 쉽게 사용할 수 있도록 만들어졌고 , HostOS 의 커널을 그대로 사용하되 , HostOS 와 Container OS 의 다른 부분만을 패키징 하여 독립 된 환경을 제공 해주는 도구 입니다 .

2.2 Kubelet Minion 을 제어하는 agent 이며 , 단일 Container 또는 Pods 를 생성 해주는 역할을 담당 합니다 .

3.3 Kube Proxy 간단한 L3 프록시이며 , kubelet 에서 생성한 Pods 의 Container 들의 RR(Round Robin) 을 담당하는 역할을 합니다 .

3.4 Pod 여러 Container 들의 묶음이 Pod 입니다 .

Page 28: Introduce Google Kubernetes

어떻게 구성이 되어있죠 ? # 028

3.5 cAdvisor Container 의 자원을 모니터링 하는 소프트웨어입니다 . 단일 Container 또는 Pods 에 대해 모니터링하고 , 이를 Kubelet 에 전달 합니다 .

3.6 Label Pods 에 이름을 붙이는 것으로 , 하나의 Pod 에 여러 가지의 Label 을 붙일 수가 있습니다 . 예를 들면 환경을 나타내는 ‘ Production’, ‘Development’, ‘Staging’ 또는 역할을 나타내는 ‘ Frontend’, ‘Backend’, ‘Worker’, ‘Logger’ 를 붙일 수가 있습니다 .

3. Key / Value Store키와 값을 저장하는 저장소 입니다 .Kubernetes 에서는 CoreOS 의 ETCD 를 사용하며 , 여기에 정보를 저장 합니다 .

Page 29: Introduce Google Kubernetes

Kubernetes Architecture # 029

어떻게 동작하는지

Architecture 를

살펴 보도록 하죠 !

Page 30: Introduce Google Kubernetes

# 030

API Server

Page 31: Introduce Google Kubernetes

# 031

API Server

Scheduler

Page 32: Introduce Google Kubernetes

# 032

API Server

Scheduler

Page 33: Introduce Google Kubernetes

# 033

API Server

Scheduler

ControllerManager

Page 34: Introduce Google Kubernetes

# 034

API Server

Scheduler

ControllerManager

Page 35: Introduce Google Kubernetes

# 035

API Server

Scheduler

ControllerManager

Page 36: Introduce Google Kubernetes

# 036

API Server

Scheduler

ControllerManager

Master

Page 37: Introduce Google Kubernetes

# 037ETCD

API Server

Scheduler

ControllerManager

Master

Page 38: Introduce Google Kubernetes

# 038ETCD

API Server

Scheduler

ControllerManager

ETCD

Master

Page 39: Introduce Google Kubernetes

# 039ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Master

Page 40: Introduce Google Kubernetes

# 040ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Master

Page 41: Introduce Google Kubernetes

# 041ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Clus-ter

Master

Page 42: Introduce Google Kubernetes

# 042ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Clus-ter

Master

Page 43: Introduce Google Kubernetes

# 043ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Clus-ter

Master

Page 44: Introduce Google Kubernetes

# 044ETCD

API Server

Scheduler

ControllerManager

ETCD

ETCD

Clus-ter

Master

Page 45: Introduce Google Kubernetes

# 045ETCD

API Server

Scheduler

ControllerManager

Minion

ETCD

ETCD

Minion

Clus-ter

Master

Page 46: Introduce Google Kubernetes

# 046ETCD

API Server

Scheduler

ControllerManager

Minion

ETCD

ETCD

Minion

Clus-ter

Master

Page 47: Introduce Google Kubernetes

# 047ETCD

API Server

Scheduler

ControllerManager

Minion

Kubelet

ETCD

ETCD

Minion

Kubelet

Clus-ter

Master

Page 48: Introduce Google Kubernetes

# 048ETCD

API Server

Scheduler

ControllerManager

Minion

Kubelet

ETCD

ETCD

Minion

Kubelet

Clus-ter

Master

Kube Proxy

Kube Proxy

Page 49: Introduce Google Kubernetes

# 049ETCD

API Server

Scheduler

ControllerManager

Minion

Kubelet

ETCD

ETCD

Minion

Kubelet

Clus-ter

Master

Kube Proxy

Kube Proxy

Page 50: Introduce Google Kubernetes

# 050ETCD

API Server

Scheduler

ControllerManager

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 51: Introduce Google Kubernetes

# 051ETCD

API Server

Scheduler

ControllerManager

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 52: Introduce Google Kubernetes

# 052ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 53: Introduce Google Kubernetes

# 053ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 54: Introduce Google Kubernetes

# 054ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 55: Introduce Google Kubernetes

# 055ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Kubelet Kube Proxy

ETCD

ETCD

Minion

Kubelet Kube Proxy

Clus-ter

Master

Page 56: Introduce Google Kubernetes

# 056ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod Pod

Kubelet Kube Proxy

ETCD

ETCD

Minion

Pod Pod

Kubelet Kube Proxy

Clus-ter

Master

Page 57: Introduce Google Kubernetes

# 057ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod Pod

Kubelet Kube Proxy

ETCD

ETCD

Minion

Pod Pod

Kubelet Kube Proxy

Clus-ter

Master

Page 58: Introduce Google Kubernetes

# 058ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 59: Introduce Google Kubernetes

# 059ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 60: Introduce Google Kubernetes

# 060ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 61: Introduce Google Kubernetes

# 061ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 62: Introduce Google Kubernetes

# 062ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 63: Introduce Google Kubernetes

# 063ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Web UI

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 64: Introduce Google Kubernetes

# 064ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Web UI

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master

Page 65: Introduce Google Kubernetes

Kubernetes HA Architecture # 065

Master 서버를 하나만 설정 한다면

Page 66: Introduce Google Kubernetes

Kubernetes HA Architecture # 066

Master 서버를 하나만 설정 한다면

장애 발생시 대처가 난감 하겠죠 ?

Page 67: Introduce Google Kubernetes

Kubernetes HA Architecture # 067

그래서 ,

HA 구성을 해야 합니다 .

Page 68: Introduce Google Kubernetes

KubernetesArchitecture

Made by ruo91

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master# 068

Page 69: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

KubernetesArchitecture

Made by ruo91

# 069

Page 70: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy

KubernetesArchitecture

Made by ruo91

# 070

Page 71: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 071

Page 72: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 072

Page 73: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 073

Page 74: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 074

Page 75: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 075

Page 76: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 076

Page 77: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 077

Page 78: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

KubernetesArchitecture

Made by ruo91

# 078

Page 79: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

Web UI

KubernetesArchitecture

Made by ruo91

# 079

Page 80: Introduce Google Kubernetes

ETCD

API Server

Scheduler

ControllerManager

kubelctl

Minion

Pod

cAdvisor

Pod

Nginx

Kubelet Kube Proxy

ETCD

ETCD

VRRP

Internet

Minion

Pod

cAdvisor

Pod

Redis

Kubelet Kube Proxy

Clus-ter

Master xN

HAProxy HAProxy

Web UI

KubernetesArchitecture

Made by ruo91

# 080

Page 81: Introduce Google Kubernetes

Kubernetes Network # 081

Kubernetes 에서는

Page 82: Introduce Google Kubernetes

Kubernetes Network # 082

Kubernetes 에서는

4 가지 정도의

Page 83: Introduce Google Kubernetes

Kubernetes Network # 083

Kubernetes 에서는

4 가지 정도의

네트워크 문제가

Page 84: Introduce Google Kubernetes

Kubernetes Network # 084

Kubernetes 에서는

4 가지 정도의

네트워크 문제가

존재합니다 .

Page 85: Introduce Google Kubernetes

Kubernetes Network # 085

첫째 , Container 와 Container 의 통신

Page 86: Introduce Google Kubernetes

Kubernetes Network # 086

첫째 , Container 와 Container 의 통신

둘째 , Pods 간의 통신

Page 87: Introduce Google Kubernetes

Kubernetes Network # 087

첫째 , Container 와 Container 의 통신

둘째 , Pods 간의 통신

셋째 , Pod 와 서비스간의 통신

Page 88: Introduce Google Kubernetes

Kubernetes Network # 088

첫째 , Container 와 Container 의 통신

둘째 , Pods 간의 통신

셋째 , Pod 와 서비스간의 통신

넷째 , 외부와 내부간의 통신

Page 89: Introduce Google Kubernetes

Kubernetes Network # 089

이런 문제를 해결 하기 위해

Page 90: Introduce Google Kubernetes

Kubernetes Network # 090

이런 문제를 해결 하기 위해

다음과 같은 것들로

Page 91: Introduce Google Kubernetes

Kubernetes Network # 091

이런 문제를 해결 하기 위해

다음과 같은 것들로

해결이 가능합니다 .

Page 93: Introduce Google Kubernetes

Kubernetes Network # 093

Flannel - Overlay Network 를 사용하는 방법 .

Link: https://github.com/coreos/flannel

Page 94: Introduce Google Kubernetes

Kubernetes Network # 094

Weave - Overlay Network 를 사용하는 방법 .

Link: https://github.com/weaveworks/weave

Page 95: Introduce Google Kubernetes

Kubernetes Network # 095

Weave - Overlay Network 를 사용하는 방법 .

Link: https://github.com/weaveworks/weave

Page 96: Introduce Google Kubernetes

Kubernetes Network # 096

Calico - BGP 를 사용하여 Real IP 를 할당 하는 방법 .

Link: http://docs.projectcalico.org/en/0.13/arch-overview.html

Page 97: Introduce Google Kubernetes

Kubernetes Network # 097

Linux Bridge 를 사용하는 방법 .Link: http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/

Page 99: Introduce Google Kubernetes

# 099

Thank you!