CoreOS in a Nutshell

Post on 15-Apr-2017

381 views 1 download

Transcript of CoreOS in a Nutshell

CoreOS in a Nutshell

Alex CrawfordSoftware Developer at CoreOS

alex.crawford@coreos.comgithub.com/crawford

What is CoreOS?

What is CoreOS?

What is CoreOS?

What is CoreOS?

The smartest way to run your container infrastructure.

tectonic.com @tectonic

QUAYSecure hosting for private container repositories

quay.io @quayio

Why build CoreOS?

you

you as a sw engineer

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!")}

your containerimage

your/bin/java

/opt/app.jar

/lib/libc

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

your com.example.app

d474e8c57737625c

your d474e8c57737625c

Signed By: Alice

ops engineer

you as an ops engineer

your

your

com.example.webappx3

your

com.example.webappx3

your

???

com.example.webappx3

How do we do it?

reduce API contracts

minimal

kernelsystemdrktsshdocker

pythonjavanginxmysqlopenssl

app

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro

pythonjavanginxmysqlopenssl

app d

istro

dist

ro d

istro

dist

ro d

istro

di

stro

kernelsystemdrktsshdocker

pythonopenssl-A app1

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro java

openssl-B app2

javaopenssl-B app3

kernelsystemdrktsshdocker

pythonopenssl-A app1

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro java

openssl-B app2

javaopenssl-B app3

CoreOS

CoreOS

container

dist

ro d

istro

dist

ro d

istro

dist

ro

dist

ro

container

container

OS operations

updates

OS operations

manual updates

automatic updates

automatic updates

atomic update with rollback

CoreOS Updates

machine configuration

OS operations

get into the cluster

machine config

[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

[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

[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

distributed configuration

cluster operations

etcd

/etcdistributed

AvailableLeader

Follower

AvailableLeader

Follower

AvailableLeader

Follower

UnavailableLeader

Follower

AvailableLeader

Follower

AvailableLeader

Follower

Temporarily Unavailable

Leader

Follower

Available

Leader

Follower

Unavailable

Leader

Follower

what should run

cluster operations

k8s/mesos/etc scheduler

scheduling

getting work to servers

scheduling

You

You

Scheduler API

You

Scheduler API

Scheduler

You

Scheduler API

Scheduler

Machine(s)

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

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

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

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

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

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

$ kubectl get podsPOD IPexample-97wt8 10.2.29.4

$ kubectl scale rc example--replicas=2

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

$ kubectl scale rc example--replicas=2

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

$ kubectl scale rc example--replicas=2

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

$ kubectl scale rc example--replicas=2

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

$ kubectl scale rc example--replicas=2

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

$ kubectl scale rc example--replicas=2

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

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

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

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

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

podenv=prodapp=web

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

podenv=prodapp=web

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

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

podenv=prodapp=web

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

where is it running

cluster operations

dns, LBs, k8s labels

services

flexible service discovery

k8s labels

podenv=devapp=web

podenv=testapp=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)

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)

podapp=foo,version=1

service foo.cluster.localselect(app=foo)

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

podapp=foo,version=1

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

podapp=foo,version=2

service foo.cluster.localselect(app=foo)

coreos.com/careers

work with us

Questions?