CoreOS: an introduction

75

Transcript of CoreOS: an introduction

Page 1: CoreOS: an introduction
Page 2: CoreOS: an introduction

About MeCTO/CO-FOUNDERsystems engineer

@brandonphilipsgithub.com/philips

Page 3: CoreOS: an introduction

What is CoreOS?

Page 4: CoreOS: an introduction

What is CoreOS?

Page 5: CoreOS: an introduction
Page 6: CoreOS: an introduction
Page 7: CoreOS: an introduction

Why build CoreOS?

Page 8: CoreOS: an introduction

reduce API contracts

minimal

Page 9: CoreOS: an introduction

kernelsystemdetcdsshdocker

pythonjavanginxmysqlopenssl

app

dis

tro

dist

ro d

istr

o di

stro

dis

tro

dist

ro d

istr

o di

stro

Page 10: CoreOS: an introduction

pythonjavanginxmysqlopenssl

app

dis

tro

dist

ro d

istr

o di

stro

dis

tro

dist

ro d

istr

o di

stro

kernelsystemdetcdsshdocker

Page 11: CoreOS: an introduction

pythonopenssl-A app1

dis

tro

dist

ro d

istr

o di

stro

dis

tro

dist

ro d

istr

o di

stro

javaopenssl-B app2

javaopenssl-B app3

kernelsystemdetcdsshdocker

Page 12: CoreOS: an introduction

CoreOS

pythonopenssl-A app1

dis

tro

dist

ro d

istr

o di

stro

dis

tro

dist

ro d

istr

o di

stro

javaopenssl-B app2

javaopenssl-B app3

Page 13: CoreOS: an introduction

CoreOS

container

dis

tro

dist

ro d

istr

o di

stro

dis

tro

dist

ro d

istr

o di

stro

container

container

Page 14: CoreOS: an introduction

manual updates

Page 15: CoreOS: an introduction

automatic updates

Page 16: CoreOS: an introduction

automatic updates

Page 17: CoreOS: an introduction

atomic with rollback

auto updates

Page 18: CoreOS: an introduction
Page 19: CoreOS: an introduction
Page 20: CoreOS: an introduction
Page 21: CoreOS: an introduction

run and isolate apps

containers

Page 22: CoreOS: an introduction

pid nsisolated pid 1

Page 23: CoreOS: an introduction

user nsisolated uid 0

Page 24: CoreOS: an introduction

network nsisolated netdev

Page 25: CoreOS: an introduction

mount nsisolated /

Page 26: CoreOS: an introduction

cgroupsmanage resources

Page 27: CoreOS: an introduction

cgroupscount resources

Page 28: CoreOS: an introduction
Page 29: CoreOS: an introduction

cgroupslimit resources

Page 30: CoreOS: an introduction

docker engine

Page 31: CoreOS: an introduction
Page 32: CoreOS: an introduction

machines and clusters

configuration

Page 33: CoreOS: an introduction

get into the cluster

machine conf

Page 34: CoreOS: an introduction

#cloud-config

users: - name: core coreos-ssh-import-github: philips

coreos: etcd: discovery: https://discovery.etcd.io/ba09c units: - name: etcd.service command: start - name: fleet.service command: start

Page 35: CoreOS: an introduction

#cloud-config

users: - name: core coreos-ssh-import-github: philips

coreos: etcd: discovery: https://discovery.etcd.io/ba09c units: - name: etcd.service command: start - name: fleet.service command: start

Page 36: CoreOS: an introduction

#cloud-config

users: - name: core coreos-ssh-import-github: philips

coreos: etcd: discovery: https://discovery.etcd.io/ba09c units: - name: etcd.service command: start - name: fleet.service command: start

Page 37: CoreOS: an introduction

#cloud-config

users: - name: core coreos-ssh-import-github: philips

coreos: etcd: discovery: https://discovery.etcd.io/ba09c units: - name: etcd.service command: start - name: fleet.service command: start

Page 38: CoreOS: an introduction

what is running

cluster conf

Page 39: CoreOS: an introduction

skydns, discoverd, confd

services

Page 40: CoreOS: an introduction

what should run

cluster conf

Page 41: CoreOS: an introduction

locksmith

coordination

Page 42: CoreOS: an introduction

fleet, kubernetes

scheduling

Page 43: CoreOS: an introduction

etcd

Page 44: CoreOS: an introduction

/etcdistributed

Page 45: CoreOS: an introduction

open source softwarehighly available and reliablesequentially consistentwatchableexposed via HTTPruntime reconfigurable

Page 46: CoreOS: an introduction

-X GETGet Wait

-X PUTPut Create CAS

-X DELETEDelete CAD

Page 47: CoreOS: an introduction

Available

Page 48: CoreOS: an introduction

Available

Page 49: CoreOS: an introduction

Available

Page 50: CoreOS: an introduction

Unavailable

Page 51: CoreOS: an introduction

Available

Leader

Follower

Page 52: CoreOS: an introduction

Leader

Follower

Available

Page 53: CoreOS: an introduction

Leader

Follower

Temporarily Unavailable

Page 54: CoreOS: an introduction

Leader

Follower

Available

Page 55: CoreOS: an introduction

Sequential ConsistencyIndex Time

Page 56: CoreOS: an introduction

1

1

1

2

GET A @ index 2 -> blocking

GET A @ index 2 -> 2

2

Page 57: CoreOS: an introduction

1

1

1

2

GET A @ index 2 -> 2

2

2

Page 58: CoreOS: an introduction

etcd guarantees that a get at index X will always return the

same result.

Avoid thinking in terms of real time because with network latency the result is always out-of-date.

Page 59: CoreOS: an introduction

Watchable ChangesHTTP Long-poll

Page 60: CoreOS: an introduction

1 2 3

> GET asdf?waitIndex=4&wait=true HTTP/1.1> Accept: */*>< HTTP/1.1 200 OK< Content-Type: application/json< X-Etcd-Index: 3< X-Raft-Index: 97< X-Raft-Term: 0<BLOCK

Page 61: CoreOS: an introduction

1 2 3 4

> GET asdf?waitIndex=4&wait=true HTTP/1.1> Accept: */*>< HTTP/1.1 200 OK< Content-Type: application/json< X-Etcd-Index: 3< X-Raft-Index: 97< X-Raft-Term: 0<{"action":"set","node":{"key":"/asdf","value":"foobar","modifiedIndex":4,"createdIndex":4}}

Page 62: CoreOS: an introduction

1 2 3 4

> GET asdf?waitIndex=4&wait=true HTTP/1.1> Accept: */*>< HTTP/1.1 200 OK< Content-Type: application/json< X-Etcd-Index: 4< X-Raft-Index: 516< X-Raft-Term: 0<{"action":"set","node":{"key":"/asdf","value":"foobar","modifiedIndex":4,"createdIndex":4}}

Page 63: CoreOS: an introduction

getting work to servers

scheduling

Page 64: CoreOS: an introduction

You

Scheduler API

Scheduler

Machine(s)

Page 65: CoreOS: an introduction

$ cat foo.service[Service]ExecStart=/usr/bin/sleep 500

$ fleetctl start foo.serviceJob foo.service launched on e1cd2bcd.../172.17.8.101

Page 66: CoreOS: an introduction

while true { todo = diff(desState, curState) schedule(todo)}

Page 67: CoreOS: an introduction

while true { todo = diff(desState, curState) schedule(todo)}

Page 68: CoreOS: an introduction

while true { todo = diff(desState, curState) schedule(todo)}

Page 69: CoreOS: an introduction

while true { todo = diff(desState, curState) schedule(todo)}

Page 70: CoreOS: an introduction

Talk tomorrow!fleet: systemd for clusters2:30pm Mississippi

Page 71: CoreOS: an introduction

Why use CoreOS?

Page 72: CoreOS: an introduction

is it ready?stable released

Page 73: CoreOS: an introduction

lots of work todo

the future

Page 74: CoreOS: an introduction
Page 75: CoreOS: an introduction

DEMO?