SlideShare a Scribd company logo
1 of 84
Planes, Raft, and Pods
A Tour of Distributed Systems Within Kubernetes
@boluptuous
?
“Open-source platform for automating
deployment, scaling, and operations of
application containers around clusters of
hosts, providing container-centric
infrastructure”
- Kubernetes Documentation
???????
Flexible platform for running
containerized apps!
● Autoscaling
● Rolling Deploys
● Secret Management
● Load Balancing
● Auto-Recovery from Failures
How does Kubernetes
leverage distributed
systems?
What is a container?
Cgroups + namespaces
Pod = 1 or more containers
Deployments manage pods
Kubernetes Architecture!
etcd!
Why etcd?
etcd is designed for “large scale distributed
systems… that never tolerate split brain
behavior and are willing to sacrifice
availability” to achieve it
- etcd Documentation
Simple interface hides
complex problems
Let’s look at a Not Raft system
New Scenario!
Consensus requires
coordination
Raft = consensus algorithm
for managing replicated log
Elected leader is put in
charge of managing the log
Three States!
● Leader
● Follower
● Candidate
One leader per term
Leader sends heartbeat
messages
What happens if a follower
doesn’t get a heartbeat?
Election time!
In the game of Raft leadership elections, you win or you lose.
1. Write goes to leader
2. Leader appends command to log
3. Tells other servers via RPC to append it
to their logs (followers will say no if
they’re behind)
4. Once majority append, leader commits
5. Leader tells nodes in subsequent
messages of the last committed entry
6. Nodes commit
Solves problems in our bad system
Consistency and partition-tolerance
are achieved through requiring a
majority of nodes to act
Further Raft Reading
● The Raft Paper
● The Secret Lives of Data
(Raft Visualization)
Controller = loop that watches cluster
state and makes changes to ensure
we keep the desired state
Replica Set Controller makes sure
there’s a given number of pods running
at any time
Deployment controller manages the
whole deployment process of your app
Scheduler watches for unscheduled pods and
assigns them to a given node
The Scheduling Algorithm
1. Filter out nodes that aren’t desired or
not a great fit
2. Rank the remaining nodes
3. Pick the top ranked node
Step 1: Filter Against Predicates
● HostName
● MatchNodeSelector
● PodFitsHostPort
● PodFitsResources
● CheckNodeMemoryPressure
● CheckNodeDiskPressure
Ranking applies a series of
weighted priority functions
that return a score from 0 to
10 (least to most desirable)
Functions are run against
each node, added up, and the
node with the highest score
is the winner!
Some Ranking Functions
● LeastRequestedPriority
● BalancedResourceAllocation
● SelectorSpreadPriority
What happens when we
submit a deployment to
Kubernetes?
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: hello-world-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: tutum/hello-world
ports:
- containerPort: 80
How do we submit our
deployment? Kubectl!
What We Expect
1. We create deployment
2. Deployment creates a replica set
3. Replica set creates three pods
4. Our scheduler schedules those three
pods
5. Kubelet will run scheduled pods
What actually happens...
These are REAL events
involvedObject:
apiVersion: extensions
kind: Deployment
name: hello-world-deployment
resourceVersion: "1097"
uid: c8806e58-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: Scaled up replica set hello-world-deployment-
3877114392 to 3
reason: ScalingReplicaSet
source:
component: deployment-controller
type: Normal
involvedObject:
apiVersion: extensions
kind: ReplicaSet
name: hello-world-deployment-3877114392
namespace: default
resourceVersion: "1098"
uid: c8811ca5-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: 'Created pod: hello-world-deployment-
3877114392-jk3ps'
reason: SuccessfulCreate
source:
component: replicaset-controller
type: Normal
involvedObject:
apiVersion: extensions
kind: ReplicaSet
name: hello-world-deployment-3877114392
namespace: default
resourceVersion: "1098"
uid: c8811ca5-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: 'Created pod: hello-world-deployment-
3877114392-nt62j'
reason: SuccessfulCreate
source:
component: replicaset-controller
type: Normal
involvedObject:
apiVersion: v1
kind: Pod
name: hello-world-deployment-3877114392-nt62j
namespace: default
resourceVersion: "1102"
uid: c8833786-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: Successfully assigned hello-world-deployment-
3877114392-nt62j to minikube
reason: Scheduled
source:
component: default-scheduler
type: Normal
involvedObject:
apiVersion: extensions
kind: ReplicaSet
name: hello-world-deployment-3877114392
namespace: default
resourceVersion: "1098"
uid: c8811ca5-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: 'Created pod: hello-world-deployment-
3877114392-c71lp'
reason: SuccessfulCreate
source:
component: replicaset-controller
type: Normal
involvedObject:
apiVersion: v1
kind: Pod
name: hello-world-deployment-3877114392-jk3ps
namespace: default
resourceVersion: "1103"
uid: c88336ab-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: Successfully assigned hello-world-deployment-
3877114392-jk3ps to minikube
reason: Scheduled
source:
component: default-scheduler
type: Normal
involvedObject:
apiVersion: v1
kind: Pod
name: hello-world-deployment-3877114392-c71lp
namespace: default
resourceVersion: "1104"
uid: c8833ea2-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:41Z
message: Successfully assigned hello-world-deployment-
3877114392-c71lp to minikube
reason: Scheduled
source:
component: default-scheduler
type: Normal
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-c71lp
namespace: default
resourceVersion: "1111"
uid: c8833ea2-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:42Z
message: pulling image "tutum/hello-world"
reason: Pulling
source:
component: kubelet
host: minikube
type: Normal
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-jk3ps
namespace: default
resourceVersion: "1109"
uid: c88336ab-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:42Z
message: pulling image "tutum/hello-world"
reason: Pulling
source:
component: kubelet
host: minikube
type: Normal
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-nt62j
namespace: default
resourceVersion: "1106"
uid: c8833786-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:42Z
message: pulling image "tutum/hello-world"
reason: Pulling
source:
component: kubelet
host: minikube
type: Normal
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-c71lp
namespace: default
resourceVersion: "1111"
uid: c8833ea2-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:44Z
message: Successfully pulled image "tutum/hello-world"
reason: Pulled
source:
component: kubelet
host: minikube
type: Normal
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-c71lp
namespace: default
resourceVersion: "1111"
uid: c8833ea2-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:44Z
message: Created container with id
c71c2605bcb7ab52e0c4fc7e08545664c628dd8eb5ceea2
0eff5ccff4afb865d
reason: Created
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-c71lp
namespace: default
resourceVersion: "1111"
uid: c8833ea2-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:44Z
message: Started container with id
c71c2605bcb7ab52e0c4fc7e08545664c628dd8eb5ceea2
0eff5ccff4afb865d
reason: Started
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-jk3ps
namespace: default
resourceVersion: "1109"
uid: c88336ab-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:45Z
message: Successfully pulled image "tutum/hello-world"
reason: Pulled
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-jk3ps
namespace: default
resourceVersion: "1109"
uid: c88336ab-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:45Z
message: Created container with id
26cc7eff24538a09647a8a595d606c1988ca802a74d1930
fdcb801aafc624075
reason: Created
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-jk3ps
namespace: default
resourceVersion: "1109"
uid: c88336ab-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:45Z
message: Started container with id
26cc7eff24538a09647a8a595d606c1988ca802a74d1930
fdcb801aafc624075
reason: Started
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-nt62j
namespace: default
resourceVersion: "1106"
uid: c8833786-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:46Z
message: Successfully pulled image "tutum/hello-world"
reason: Pulled
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-nt62j
namespace: default
resourceVersion: "1106"
uid: c8833786-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:46Z
message: Created container with id
ef8a53303a35c539d7a16f2d633d7f7f6f70d42c6dc7f629
da771a49a95a0c25
reason: Created
source:
component: kubelet
host: minikube
involvedObject:
apiVersion: v1
fieldPath: spec.containers{hello-world}
kind: Pod
name: hello-world-deployment-3877114392-nt62j
namespace: default
resourceVersion: "1106"
uid: c8833786-5371-11e7-9d84-0800278f5909
kind: Event
lastTimestamp: 2017-06-17T15:29:46Z
message: Started container with id
ef8a53303a35c539d7a16f2d633d7f7f6f70d42c6dc7f629
da771a49a95a0c25
reason: Started
source:
component: kubelet
host: minikube
We’ve got a running app...
...but no way to talk to it.
We’ll add a service!
kind: Service
apiVersion: v1
metadata:
name: hello-world-service
spec:
selector:
app: hello-world
ports:
- protocol: TCP
port: 80
type: NodePort
We did it!
Things We’ve Done
● Look at Kubernetes components
● Shown how it handles distributed
state
● Dove into how we reconcile state and
schedule pods
● Trace a deployment through the
system
Questions?

More Related Content

What's hot

What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in KubernetesDaniel Smith
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Ryan Jarvinen
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionStefan Schimanski
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introductionSparkbit
 
Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Vishnu Kannan
 
Kubernetes Introduction & Whats new in Kubernetes 1.6
Kubernetes Introduction & Whats new in Kubernetes 1.6Kubernetes Introduction & Whats new in Kubernetes 1.6
Kubernetes Introduction & Whats new in Kubernetes 1.6Opcito Technologies
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with KubernetesDeivid Hahn Fração
 
Marc Sluiter - 15 Kubernetes Features in 15 Minutes
Marc Sluiter - 15 Kubernetes Features in 15 MinutesMarc Sluiter - 15 Kubernetes Features in 15 Minutes
Marc Sluiter - 15 Kubernetes Features in 15 MinutesMarc Sluiter
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 
Kubernetes automation in production
Kubernetes automation in productionKubernetes automation in production
Kubernetes automation in productionPaul Bakker
 
Evolution of containers to kubernetes
Evolution of containers to kubernetesEvolution of containers to kubernetes
Evolution of containers to kubernetesKrishna-Kumar
 
Kubernetes Architecture - beyond a black box - Part 2
Kubernetes Architecture - beyond a black box - Part 2Kubernetes Architecture - beyond a black box - Part 2
Kubernetes Architecture - beyond a black box - Part 2Hao H. Zhang
 
Kubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupKubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupMist.io
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshoploodse
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive OverviewBob Killen
 

What's hot (20)

Kubernetes Node Deep Dive
Kubernetes Node Deep DiveKubernetes Node Deep Dive
Kubernetes Node Deep Dive
 
What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in Kubernetes
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introduction
 
Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10
 
Kubernetes Introduction & Whats new in Kubernetes 1.6
Kubernetes Introduction & Whats new in Kubernetes 1.6Kubernetes Introduction & Whats new in Kubernetes 1.6
Kubernetes Introduction & Whats new in Kubernetes 1.6
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with Kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Marc Sluiter - 15 Kubernetes Features in 15 Minutes
Marc Sluiter - 15 Kubernetes Features in 15 MinutesMarc Sluiter - 15 Kubernetes Features in 15 Minutes
Marc Sluiter - 15 Kubernetes Features in 15 Minutes
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
Kubernetes automation in production
Kubernetes automation in productionKubernetes automation in production
Kubernetes automation in production
 
Kubernetes 101 and Fun
Kubernetes 101 and FunKubernetes 101 and Fun
Kubernetes 101 and Fun
 
Evolution of containers to kubernetes
Evolution of containers to kubernetesEvolution of containers to kubernetes
Evolution of containers to kubernetes
 
Intro to Kubernetes
Intro to KubernetesIntro to Kubernetes
Intro to Kubernetes
 
Kubernetes Architecture - beyond a black box - Part 2
Kubernetes Architecture - beyond a black box - Part 2Kubernetes Architecture - beyond a black box - Part 2
Kubernetes Architecture - beyond a black box - Part 2
 
Kubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupKubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetup
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview
 

Similar to Planes, Raft, and Pods: A Tour of Distributed Systems Within Kubernetes

Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)QAware GmbH
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015Rohit Jnagal
 
Kubernetes intro public - kubernetes user group 4-21-2015
Kubernetes intro   public - kubernetes user group 4-21-2015Kubernetes intro   public - kubernetes user group 4-21-2015
Kubernetes intro public - kubernetes user group 4-21-2015reallavalamp
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesRishabh Indoria
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kevin Lynch
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetesTed Jung
 
How to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesHow to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesAndreaMedeghini
 
Kubernetes - Why It's Cool & Why It Maaters
Kubernetes - Why It's Cool & Why It MaatersKubernetes - Why It's Cool & Why It Maaters
Kubernetes - Why It's Cool & Why It MaatersBob Reselman
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Puppet
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practiceDocker, Inc.
 
Kubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slidesKubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slidesWeaveworks
 
Nex clipper 1905_summary_eng
Nex clipper 1905_summary_engNex clipper 1905_summary_eng
Nex clipper 1905_summary_engJinyong Kim
 
Creating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesPaul Goldbaum
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeDocker, Inc.
 
Phil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerPhil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerAWSCOMSUM
 
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, KyivKubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, KyivAleksey Asiutin
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 

Similar to Planes, Raft, and Pods: A Tour of Distributed Systems Within Kubernetes (20)

Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015
 
Kubernetes intro public - kubernetes user group 4-21-2015
Kubernetes intro   public - kubernetes user group 4-21-2015Kubernetes intro   public - kubernetes user group 4-21-2015
Kubernetes intro public - kubernetes user group 4-21-2015
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetes
 
How to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesHow to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on Kubernetes
 
Kubernetes - Why It's Cool & Why It Maaters
Kubernetes - Why It's Cool & Why It MaatersKubernetes - Why It's Cool & Why It Maaters
Kubernetes - Why It's Cool & Why It Maaters
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Distributed fun with etcd
Distributed fun with etcdDistributed fun with etcd
Distributed fun with etcd
 
Kubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slidesKubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slides
 
Nex clipper 1905_summary_eng
Nex clipper 1905_summary_engNex clipper 1905_summary_eng
Nex clipper 1905_summary_eng
 
Creating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and Kubernetes
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
 
Phil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerPhil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage maker
 
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, KyivKubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 

Recently uploaded

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 

Recently uploaded (20)

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 

Planes, Raft, and Pods: A Tour of Distributed Systems Within Kubernetes

Editor's Notes

  1. https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
  2. These are pretty cool things, and most talks about Kubernetes concentrates on these things. I’d like to do something a little different. Let’s all be in agreement that Kubernetes can do it, and they’re cool. I want to peek behind the curtain.
  3. https://jvns.ca/blog/2016/10/10/what-even-is-a-container/ Cgroups - specify limits for how much memory and CPU a process can use Namespace - stop process from interfering with other processes Containerized app examples - nginx deployment, microservice, Redis instance
  4. 1 or more containers that share a unique IP guaranteed to have all containers running on the same host can share disk volumes (ex. App that logs to file, sidecar to forward logs)
  5. Declarative way of managing pods What containers we want to run and how many instances Use replica sets under the hood - make sure # running in cluster is = # desired
  6. Etcd - distributed k/v store that serves as Kubernetes database API server - controls access to etcd - interacted with via REST calls Controller manager - background threads that handle routine cluster tasks such as making sure a deployment has enough pods deployed and triggers the scheduling of new ones if needed scheduler - schedules unscheduled pods, whenever there’s an unscheduled pod, the scheduler determines where the appropriate home for it is. These components collectively make up the control plane and run on the master hosts in the cluster. Kubelet - watches for pods that have been assigned to node and runs them, constantly polls API server + local config, cAdvisor - metrics collector Kube proxy - handles some networking stuff
  7. https://www.comp.nus.edu.sg/~gilbert/pubs/BrewersConjecture-SigAct.pdf Consistency - always reading the most recently written value Availability - every request to a non-failing node receives a response Partition-tolerance - system can handle the dropping of messages between nodes Etcd is consistent/partition-tolerant If in a 5 node cluster, 3 nodes take a dive, the other 2 stop responding to requests until the quroum is restored
  8. If your goal is to have a system for running containerized applications, you need something that plays nice with clustered systems
  9. CAP theorem reference - etcd is going to sacrifice availability to preserve consistency Clarification -> Etcd unavailability doesn’t take down k8s, just the ability to mutate
  10. Typical CRUD operations through rest calls or command line tool - etcdctl How do the nodes agree on what a value is for a given key? If not done smartly, things can go awry pretty quickly How does etcd agree on the value for a given key while still upholding its consistency guarantee?
  11. Method of achieving distributed consensus - having multiple distributed servers agree on what the value is for a given key in a fault tolerant manner Trivial way to solve - the value is always 3
  12. Typical CRUD operations through rest calls or command line tool - etcdctl How do the nodes agree on what a value is for a given key? If not done smartly, things can go awry pretty quickly How does etcd agree on the value for a given key while still upholding its consistency guarantee?
  13. Imagine a system that does NOT implement the Raft algorithm Three nodes, A, B, C that each store a single value When a client wants to read a value it contacts any node and gets its value When a client wants to write a value, it contacts any node, and that node tells all the other nodes of the new value
  14. Now contemplate what happens if three clients update the value in three different ways at the same time. At time t=0, 3 clients write 3 different values to our 3 nodes simultaneously
  15. At time t=5, after all updates have been applied, what’s the value, assuming no other writes have occurred? No idea! In fact, it’s possible for each node to have a different value depending on what order messages were received in
  16. All of the previous messages have been lost forever After the network recovers, the value at C is still going to be M until someone updates the value.
  17. Seemingly simple systems can fail in all sorts of Fun ways when exposed to concurrent operations In order for consensus to be achived, we’re going to require greater coordination between our nodes This is where Raft comes into play
  18. Replicated log - series of commands executed in order by a state machine We want each log to have the same commands in the same order so that each machine has the same state
  19. Accepts entries from clients, replicates them on other nodes, says when it’s safe to actually apply them If leader fails, a new one is elected
  20. Followers just hang out, respond to requests from leaders Leader handles all the requests and does all of the fun coordination Candidate is the state used to elect a new leader
  21. Part of dealing with ordered statements is dealing with time Raft uses an incrementing integer timestamp called a term, which is tied to an election Terms last until there’s a new leader Serves as a logical clock and aid in detecting obsolete info (like stale leaders)
  22. Leaders send heartbeat messages to the follower nodes, saying “Hey I’m still alive”
  23. Follower increments term and declares itself as a candidate Sends an RPC request out for votes to all of the other servers
  24. Servers vote for the first candidate who asks for their votes, assuming the candidate is at least as up to date as the voter. If the voter has entries that the candidate doesn’t, then the voter isn’t going to vote for that candidate. If the candidate gets a majority of the votes, it wins! It sends out a new set of heartbeat messages to notify others of its victory, and life goes on
  25. Simultaneous write scenario solved by requirement that all writes go to leader Leader receives each write, and each write is a new entry with a new index -- can’t occur simultaneously Network partition scenario - followers reject requests if they’re behind and will eventually be caught up also, requests go to the leader and our dead node can’t become leader because it’s behind - effect is minimized
  26. Elections require a majority of the nodes to agree to elect a leader All writes require a majority of the nodes to replicate the transaction to be successful If we lose more than half the nodes, then we’re unable to do anything
  27. https://raft.github.io/ http://thesecretlivesofdata.com/raft/
  28. Kubernetes actually suggests you don’t interact with replica sets directly, we instead use the deployment controller to manage them It knows which pods to manage through labels, we define labels on the pods we create and we tell the replica set which labels it should look for so that it knows which pods to manage
  29. Provides a declarative way of managing pods and uses that to roll out your desired changes in a friendly way Handles rolling deploys, rolling back your application, and autoscaling it out as well
  30. What it’s looking for specifically are pods without a node name Constantly querying the API server (and by extension, etcd) looking for those unscheduled pods
  31. HostName - compares the node’s name to the node name specified in the pod spec (if any), excludes every node that doesn’t match, lets us schedule directly to that node, assuming it passes other predicates MatchNodeSelector - variant of HostName, Kubernetes let you provide label selectors to associate resources using labels, this predicate checks that the node selector supplied in the pod spec is valid for a given node Scheduler also checks the resources of each node PodFitsHostPort - whether or not the host port (a hard-coded port specified in the pod spec) is available for that node, if not available -> filtered out PodFitsResources - another resource-aware check, pods can request a given amount of CPU and memory; this predicate checks whether the node is capable of satisfying that request CheckNodeMemoryPressure and CheckNodeDiskPressure won’t schedule onto nodes whose memory usage or disk usage is too high Also volume checks - make sure that we’re not using more than allowed (for cloud providers) or there’s no conflicts on volume claims
  32. Ties are broken by randomly picking a winner
  33. Most obvious strategy is put our pod on the least used note - LeastRequestedPriority - calculates how much CPU + memory (equally weighted and added together) would be left after scheduling pod to that node - helps with balancing resource usage across cluster BalancedResourceAllocation - attempts to prevent nodes from being largely weighted towards CPU or memory usage - try to avoid nodes with 95% CPU usage and 5% memory usage Checks to see how the pod affects the balance of resource usage, favoring nodes who would have CPU utilization closer to memory utilization after scheduling Last one I want to look at is SelectorSpreadPriority Lose a great chunk of the benefits of having multiple copies of an application if they’re all sitting on the same node. If the node goes down, you’ll lose every copy of the app that’s running on the node (insert metaphor about eggs and baskets) This function minimizes the amount of pods from the same service or replica set on the same node, causing our currently-being-scheduled pods to favor nodes without its managed siblings
  34. Specify we want three instances We’re going to label it with the tag ‘app:hello-world’ Going to launch the hello-world container, when we hit port 80 it’ll return a hello world!
  35. We use kubectl to actually get our app running in kubernetes Kubectl is how we interact with the cluster - can view resources as well as modfiy them Gives a wonderful view of what’s going on with our cluster We can check the status of our pods, our deployments, and importantly for us right now, use it to construct a timeline of events
  36. Though they’ve been formatted to fit the screen
  37. A service defines a logical set of pods and a policy by which to access them - load balancer, port exposed on the host, external IP
  38. Defines a service that “selects” pods with the app tag with a value of hello-world Exposes the service as a port on the node Can’t do a load balancer because that requires a cloud provider, otherwise we could create an Amazon ELB or whatever google cloud’s equiavalent We’ll also create this via kubectl