CoreOS in a Nutshell
Alex Crawford
Software Developer at CoreOS
alex.crawford@coreos.com
github.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
QUAY
Secure 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 container
image
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.webapp
x3
your
com.example.webapp
x3
your
???
com.example.webapp
x3
How do we do it?
reduce API contracts
minimal
kernel
systemd
rkt
ssh
docker
python
java
nginx
mysql
openssl
app
trodistrodistrodistrodistrodistro
python
java
nginx
mysql
openssl
apptrodistrodistrodistrodistrodistro
kernel
systemd
rkt
ssh
docker
python
openssl-A
app1
trodistrodistrodistrodistrodistro
java
openssl-B
app2
java
openssl-B
app3
kernel
systemd
rkt
ssh
docker
python
openssl-A
app1
trodistrodistrodistrodistrodistro
java
openssl-B
app2
java
openssl-B
app3
CoreOS
CoreOS
container
trodistrodistrodistrodistrodistro
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
/etc
distributed
Available
Leader
Follower
Available
Leader
Follower
Available
Leader
Follower
Unavailable
Leader
Follower
Available
Leader
Follower
Available
Leader
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 pods
POD IP
example-97wt8 10.2.29.4
$ kubectl run example
--image=quay.io/crawford/example
--replicas=1
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
$ kubectl run example
--image=quay.io/crawford/example
--replicas=1
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
$ kubectl run example
--image=quay.io/crawford/example
--replicas=1
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
$ kubectl run example
--image=quay.io/crawford/example
--replicas=1
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
$ kubectl run example
--image=quay.io/crawford/example
--replicas=1
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
$ kubectl scale rc example
--replicas=2
$ kubectl get pods
POD IP
example-97wt8 10.2.29.4
example-f839d 10.2.29.8
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=prod
app=web
rc web-prod
select(env=prod,app=web)
count=3
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=prod
app=web
rc web-prod
select(env=prod,app=web)
count=1
pod
env=prod
app=web
rc web-prod
select(env=prod,app=web)
count=1
pod
env=prod
app=web
rc web-prod
select(env=prod,app=web)
count=5
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=prod
app=web
rc web-prod
select(env=prod,app=web)
count=5
where is it running
cluster operations
dns, LBs, k8s labels
services
flexible service discovery
k8s labels
pod
env=dev
app=web
pod
env=test
app=web
pod
env=prod
app=web
pod
env=dev
app=web
pod
env=test
app=web
pod
env=prod
app=web
service test.example.com
select(env=dev,app=web)
service beta.example.com
select(env=test,app=web)
OR
select(env=prod,app=web)
service example.com
select(env=prod,app=web)
pod
env=test
app=web
pod
env=prod
app=web
pod
env=prod
app=web
pod
env=dev
app=web
pod
env=test
app=web
pod
env=prod
app=web
service test.example.com
select(env=dev,app=web)
service beta.example.com
select(env=test,app=web)
OR
select(env=prod,app=web)
service example.com
select(env=prod,app=web)
pod
app=foo,version=1
service foo.cluster.local
select(app=foo)
pod
app=foo,version=1
pod
app=foo,version=2
service foo.cluster.local
select(app=foo)
pod
app=foo,version=1
pod
app=foo,version=2
service foo.cluster.local
select(app=foo)
pod
app=foo,version=1
pod
app=foo,version=2
service foo.cluster.local
select(app=foo)
pod
app=foo,version=2
service foo.cluster.local
select(app=foo)
coreos.com/careers
work with us
Questions?