Kubernetes in 30 Minutes20170310 170313090249
Kubernetes in 30 Minutes20170310 170313090249
30 minutes
Mar 10, 2017
…and others
Basic Concepts
Node
Hosts running
k8s daemons
Master
API
Scheduler
etc..
container
Pod
container
container
container
Pod
e.g.
container nginx
container app
container redis/cache
Scheduled together
(“co-scheduled”)
Guaranteed to be
on the same node
(“co-located”)
Node Node Node
Node Node Node
container
container
container
Node Node
container
container
Miscellaneous
A
Replica Set
replicas: 3
template:
A B
Replica Set
replicas: 3
template:
A B C
Replica Set
replicas: 3
template:
A B C
Replica Set
replicas: 3
template:
A B
Replica Set
replicas: 3
template:
A B D
Deployment
Manages Replica Set
state transitions
Deployment
replicas: 3
template:
Deployment
replicas: 3
template:
Replica Set A
replicas: 3
template:
Deployment
replicas: 3
Change some settings, template:
please!
Replica Set A
replicas: 3
template:
Deployment
replicas: 23
Change some settings, template:
please!
Replica Set A
replicas: 3
template:
Deployment
replicas: 23
Change some settings, template:
please!
replicas: 3
replicas: 2
template: template:
Deployment
replicas: 23
Change some settings, template:
please!
replicas: 3
replicas: 2
template: template:
Deployment
replicas: 23
Change some settings, template:
please!
Replica Set B
replicas: 2
template:
Keeps track of
state change history
Deployment
replicas: 3
template:
Deployment
replicas: 3
template:
A
replicas: 3
template:
Deployment
replicas: 3
Change some settings, template:
please!
A
replicas: 3
template:
Deployment
replicas: 23
Change some settings, template:
please!
A
replicas: 3
template:
Deployment
replicas: 23
Change some settings, template:
please!
A B
replicas: 3
replicas: 2
template: template:
Deployment
replicas: 23
Change some settings, template:
please!
A B
replicas: 3
replicas: 2
template: template:
Deployment
replicas: 23
Change some settings, template:
please!
B
replicas: 2
template:
Deployment
replicas: 23
Oh wait, I actually template:
didn’t want to do that…
B
replicas: 2
template:
Deployment
replicas: 323
Oh wait, I actually template:
didn’t want to do that…
B
replicas: 2
template:
Deployment
replicas: 323
Oh wait, I actually template:
didn’t want to do that…
B
rollback replicas: 2
template:
Deployment
replicas: 323
Oh wait, I actually template:
didn’t want to do that…
A B
replicas: 3
rollback replicas: 2
template: template:
Deployment
replicas: 323
Oh wait, I actually template:
didn’t want to do that…
A B
replicas: 3
rollback replicas: 2
template: template:
Deployment
replicas: 323
Oh wait, I actually template:
didn’t want to do that…
A
replicas: 3
template:
Services
Logical set of Pods
(and ways to access them)
Raw Pod Access
Pod 10.0.96.2
Pod 10.0.96.3
Pod 10.0.96.3
Raw Pod Access
Pod 10.0.96.2
Pod 10.0.96.3
Pod 10.0.96.3
Raw Pod Access
Pod 10.0.96.2
Pod 10.0.96.3
Pod 10.0.96.3
Raw Pod Access
Pod 10.0.96.2
Pod 10.0.96.3
Raw Pod Access
Pod 10.0.96.2
Pod 10.0.96.3
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Service
match role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Service
match role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Access Via Service
Pod 10.0.96.2
role=web
Pod 10.0.96.4
role=web
Pod 10.0.96.5
role=db
Secrets
Store pieces of
data in k8s
e.g. Identity Information
(securely)
(…in the future)
Secret
key1 → base64 value
volumes:
volumes - name: certificates
secret:
secretName: ca-certificates
Pod
env:
container - name: foo-secret
valueFrom:
secretKeyRef:
name: foo
volumes value: secret-value
ConfigMaps
Same as Secrets
(Unprotected)
Ingress
Services are for within the
cluster only
(external IPs allowed, but don’ use that to serve
external requests)
Inbound connections to
internal cluster services
(New since 1.2)
Please checkout my presentation
https://docs.google.com/presentation/d/
11ZN6qgiuZZfVyhBK2hjp1vhp_5N0DOGnAmhPreS3L5A/pub?
start=false&loop=false&delayms=3000
DaemonSets
Ensure nodes run a copy of a Pod
Node Node Node