Demystifying
theNuts&Boltsof
Kubernetes
Architecture
ReplicaSet101
2
WhoAmI?
PrincipalSystemsDevelopmentEngineeratDellEMC
WorkedwithVMware&CGI
DockerCaptain|DockerCommunityLeader
CollabnixSlack–1800+Members
DockerLabs–500+tutorials
http://www.collabnix.com
Howcanyouensurethatthereare3Podsinstanceswhich
arealwaysavailableandrunningatonepointintime?
WhatisReplicaSetallabout?
MaintainastablesetofreplicaPodsrunningatanygiventime
- EnsuresthataspecifiednumberofPodsarerunningatanytime

a.IfthereareaccessPods,theygetkilledandviceversa
b.NewPodsarelaunchedwhentheygetfailed,getdeletedandterminated
-ReplicaSet&Podsareassociatedwith“labels”
ReplicationControllerVsReplicaSet
- ReplicaSetisthenextgenerationofReplicationController
- Bothservethesamepurpose
ReplicaSetReplicationController
Set-basedSelectors
Equality-basedSelectors
Labels&Selectors
WhenPodsarescaled,howarethesePodsManagedatsuchlargescale?
Pods
Controllers&Services
Labels
Selectors
#Pod-Spec
apiVersion:v1
kind:pod
metadata:
name:nginx-Pod
labels:
app:guestbook
tier:frontend
env:dev
spec:
replicas:5..
7
Equality-basedSelectorsSet-basedSelectors
Operators:
=and==
Examples:
environment=production
tier!=frontend
Commandline:
$kubectlgetpods-lenvironment=production
InManifest:
..
selector:
environment:production
tier:frontend
..
Operators:
innotinexists
Examples:
environmentin(production,qa)
tiernotin(frontend,backend)
Commandline:
$kubectlgetpods-l`enviornmentin(production)
InManifest:
..
selector:
matchExpressions:
-{key:environment,operator:in,values:[prod,qa]}
-{key:tier,operator:Notin,values:[frontend,backend]}
..
Supports:Services,ReplicationController
Supports:Job,Deployment,ReplicaSet,DaemonSet
8
9
ReplicaSetExamples:
§ Manifestfile
§ DeployappusingRS
§ DisplayandvalidateRS
§ Test–NodeFails
§ Test–ScaleUp
§ Test–ScaleDown
10
ReplicaSetManifestFile
11
CreatingNginx-rsPods
$kubectlcreate–fnginx-rs.yaml
12
CheckingthestateofReplicaSet
13
ScalingtheNginxService
14
Demo
CreatingYourFirstReplicaSet-4PodsservingNginx
RemovingaPodfromReplicaSet
Scaling&AutoscalingaReplicaSet
BestPractices
DeletingReplicaSets