CoreOS in a Nutshell

100
CoreOS in a Nutshell Alex Crawford Software Developer at CoreOS [email protected] github.com/crawford

Transcript of CoreOS in a Nutshell

Page 1: CoreOS in a Nutshell

CoreOS in a Nutshell

Alex CrawfordSoftware Developer at CoreOS

[email protected]/crawford

Page 2: CoreOS in a Nutshell

What is CoreOS?

Page 3: CoreOS in a Nutshell

What is CoreOS?

Page 4: CoreOS in a Nutshell
Page 5: CoreOS in a Nutshell
Page 6: CoreOS in a Nutshell

What is CoreOS?

Page 7: CoreOS in a Nutshell

What is CoreOS?

Page 8: CoreOS in a Nutshell
Page 9: CoreOS in a Nutshell

The smartest way to run your container infrastructure.

tectonic.com @tectonic

Page 10: CoreOS in a Nutshell

QUAYSecure hosting for private container repositories

quay.io @quayio

Page 11: CoreOS in a Nutshell

Why build CoreOS?

Page 12: CoreOS in a Nutshell

you

Page 13: CoreOS in a Nutshell

you as a sw engineer

Page 14: CoreOS in a Nutshell

your

with Ada.Text_IO; procedure Hello_World is use Ada.Text_IO;begin Put_Line("Hello, world!");end;

#include <stdio.h> int main(){ printf("Hello, world!\n");}

package main import "fmt" func main() {

fmt.Println("Hello, world!")}

Page 15: CoreOS in a Nutshell

your containerimage

Page 16: CoreOS in a Nutshell

your/bin/java

/opt/app.jar

/lib/libc

Page 17: CoreOS in a Nutshell

your /bin/python/opt/app.py/lib/libc

Page 18: CoreOS in a Nutshell

your com.example.app

d474e8c57737625c

Page 19: CoreOS in a Nutshell

your d474e8c57737625c

Signed By: Alice

Page 20: CoreOS in a Nutshell

ops engineer

Page 21: CoreOS in a Nutshell

you as an ops engineer

Page 22: CoreOS in a Nutshell

your

Page 23: CoreOS in a Nutshell

your

com.example.webappx3

Page 24: CoreOS in a Nutshell

your

com.example.webappx3

Page 25: CoreOS in a Nutshell

your

???

com.example.webappx3

Page 26: CoreOS in a Nutshell

How do we do it?

Page 27: CoreOS in a Nutshell

reduce API contracts

minimal

Page 28: CoreOS in a Nutshell

kernelsystemdrktsshdocker

pythonjavanginxmysqlopenssl

app

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro

Page 29: CoreOS in a Nutshell

pythonjavanginxmysqlopenssl

app d

istro

dist

ro d

istro

dist

ro d

istro

di

stro

kernelsystemdrktsshdocker

Page 30: CoreOS in a Nutshell

pythonopenssl-A app1

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro java

openssl-B app2

javaopenssl-B app3

kernelsystemdrktsshdocker

Page 31: CoreOS in a Nutshell

pythonopenssl-A app1

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro java

openssl-B app2

javaopenssl-B app3

CoreOS

Page 32: CoreOS in a Nutshell

CoreOS

container

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro

container

container

Page 33: CoreOS in a Nutshell
Page 34: CoreOS in a Nutshell

OS operations

Page 35: CoreOS in a Nutshell

updates

OS operations

Page 36: CoreOS in a Nutshell

manual updates

Page 37: CoreOS in a Nutshell

automatic updates

Page 38: CoreOS in a Nutshell

automatic updates

Page 39: CoreOS in a Nutshell
Page 40: CoreOS in a Nutshell
Page 41: CoreOS in a Nutshell

atomic update with rollback

CoreOS Updates

Page 42: CoreOS in a Nutshell

machine configuration

OS operations

Page 43: CoreOS in a Nutshell

get into the cluster

machine config

Page 44: CoreOS in a Nutshell

[Service]ExecStart=/usr/bin/kubelet --api_servers=https://172.17.4.101 --register-node=true --hostname-override=172.17.4.201 --cluster_dns=10.3.0.10 --cluster_domain=cluster.local --tls-cert-file=worker.pem --tls-private-key-file=worker-key.pem

Page 45: CoreOS in a Nutshell

[Service]ExecStart=/usr/bin/kubelet --api_servers=https://172.17.4.101 --register-node=true --hostname-override=172.17.4.201 --cluster_dns=10.3.0.10 --cluster_domain=cluster.local --tls-cert-file=worker.pem --tls-private-key-file=worker-key.pem

Page 46: CoreOS in a Nutshell

[Service]ExecStart=/usr/bin/kubelet --api_servers=https://172.17.4.101 --register-node=true --hostname-override=172.17.4.201 --cluster_dns=10.3.0.10 --cluster_domain=cluster.local --tls-cert-file=worker.pem --tls-private-key-file=worker-key.pem

Page 47: CoreOS in a Nutshell

distributed configuration

cluster operations

Page 48: CoreOS in a Nutshell

etcd

Page 49: CoreOS in a Nutshell

/etcdistributed

Page 50: CoreOS in a Nutshell

AvailableLeader

Follower

Page 51: CoreOS in a Nutshell

AvailableLeader

Follower

Page 52: CoreOS in a Nutshell

AvailableLeader

Follower

Page 53: CoreOS in a Nutshell

UnavailableLeader

Follower

Page 54: CoreOS in a Nutshell

AvailableLeader

Follower

Page 55: CoreOS in a Nutshell

AvailableLeader

Follower

Page 56: CoreOS in a Nutshell

Temporarily Unavailable

Leader

Follower

Page 57: CoreOS in a Nutshell

Available

Leader

Follower

Page 58: CoreOS in a Nutshell

Unavailable

Leader

Follower

Page 59: CoreOS in a Nutshell

what should run

cluster operations

Page 60: CoreOS in a Nutshell

k8s/mesos/etc scheduler

scheduling

Page 61: CoreOS in a Nutshell

getting work to servers

scheduling

Page 62: CoreOS in a Nutshell

You

Page 63: CoreOS in a Nutshell

You

Scheduler API

Page 64: CoreOS in a Nutshell

You

Scheduler API

Scheduler

Page 65: CoreOS in a Nutshell

You

Scheduler API

Scheduler

Machine(s)

Page 66: CoreOS in a Nutshell

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

Page 67: CoreOS in a Nutshell

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

Page 68: CoreOS in a Nutshell

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

Page 69: CoreOS in a Nutshell

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

Page 70: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 71: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 72: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 73: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 74: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 75: CoreOS in a Nutshell

$ kubectl run example--image=quay.io/crawford/example--replicas=1

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

Page 76: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 77: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 78: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 79: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 80: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 81: CoreOS in a Nutshell

$ kubectl scale rc example--replicas=2

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4example-f839d 10.2.29.8

Page 82: CoreOS in a Nutshell

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

rc web-prodselect(env=prod,app=web)count=3

Page 83: CoreOS in a Nutshell

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

rc web-prodselect(env=prod,app=web)count=1

Page 84: CoreOS in a Nutshell

podenv=prodapp=web

rc web-prodselect(env=prod,app=web)count=1

Page 85: CoreOS in a Nutshell

podenv=prodapp=web

rc web-prodselect(env=prod,app=web)count=5

Page 86: CoreOS in a Nutshell

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

rc web-prodselect(env=prod,app=web)count=5

Page 87: CoreOS in a Nutshell

where is it running

cluster operations

Page 88: CoreOS in a Nutshell

dns, LBs, k8s labels

services

Page 89: CoreOS in a Nutshell

flexible service discovery

k8s labels

Page 90: CoreOS in a Nutshell

podenv=devapp=web

podenv=testapp=web

podenv=prodapp=web

Page 91: CoreOS in a Nutshell

podenv=devapp=web

podenv=testapp=web

podenv=prodapp=web

service test.example.comselect(env=dev,app=web)

service beta.example.comselect(env=test,app=web)

ORselect(env=prod,app=web)

service example.comselect(env=prod,app=web)

Page 92: CoreOS in a Nutshell

podenv=testapp=web

podenv=prodapp=web

podenv=prodapp=web

podenv=devapp=web

podenv=testapp=web

podenv=prodapp=web

service test.example.comselect(env=dev,app=web)

service beta.example.comselect(env=test,app=web)

ORselect(env=prod,app=web)

service example.comselect(env=prod,app=web)

Page 93: CoreOS in a Nutshell

podapp=foo,version=1

service foo.cluster.localselect(app=foo)

Page 94: CoreOS in a Nutshell

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

Page 95: CoreOS in a Nutshell

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

Page 96: CoreOS in a Nutshell

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

Page 97: CoreOS in a Nutshell

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

Page 98: CoreOS in a Nutshell
Page 99: CoreOS in a Nutshell

coreos.com/careers

work with us

Page 100: CoreOS in a Nutshell

Questions?