Kuber Net Es
Kuber Net Es
Kuber Net Es
2
Node running Docker
3
Clustering
4
Clustering
5
Container Orchestration
6
Orchestration Tools
● Docker Swarm ● Azure Container Service, AKS
7
News from Past
8
Kubernetes History
● Created by Google to manage their containers AKA Borg
● Mid-2014: Google introduced Kubernetes as an open source version of Borg
● July 21-2015: Kubernetes v1.0 gets released. Along with the release, Google
partnered with the Linux Foundation to form the Cloud Native Computing
Foundation (CNCF).
● 2016: Kubernetes Goes Mainstream!
○ Kops, Minikube, kubeadm etc
○ September 29: Pokemon GO! Kubernetes Case Study Released!
● 2017: Enterprise Adoption
○ Google and IBM announce Istio
○ Github runs on Kubernetes
○ Oracle joined the Cloud Native Computing Foundation
9
Kubernetes Provides
● Service discovery and load balancing
● Storage orchestration
● Self-healing
10
Kubernetes Architecture
11
Master: Kube API Server
● Main Hero! Handles all the requests and enables communication
across stack services.
12
Master: ETCD Server
● Stores all the information
13
Master: Kube Scheduler
● watches newly created pods that have no node assigned, and
selects a node for them to run on
● Factors taken into account for scheduling decisions include
○ individual and collective resource requirements,
○ hardware/software/policy constraints,
○ affinity and anti-affinity specifications,
○ data locality,
○ inter-workload interference and deadlines
14
Master: Controller Manager
❖ Logically, each controller is a separate process,
❖ To reduce complexity, they are all compiled into a single binary and run in a
single process.
● Kube Proxy
○ network proxy that runs on each node in your cluster
○ Network Rule
■ rules allow network communication to your Pods inside or outside of your cluster
16
Addons
● DNS
● Web UI
17
Addons
18
PODS
19
PODS
20
Overlay Network
21
Kubernetes Setup Tools
● Hard Way: Manual Setup
● Minikube:
○ One Node Kubernetes cluster on your computer
● Kubeadm:
○ Multi node Kubernetes Cluster
○ Can be created on any Platforms vm’s, ec2, physical machines etc
● Kops:
○ Multi node Kubernetes Cluster on AWS
22
Setup with Minikube
● Open Powershell as Admin
● Setup Chocolaty
● Install Minikube with Chocolaty
23
Setup with Kops
(Prerequisites)
● Domain for Kubernetes DNS records
○ e:g groophy.in from GoDaddy
24
Setup with Kops
Login to Domain Registrar(GoDaddy)
Create NS records for subdomain pointing to Routes 53 hosted zone NS servers
25
1
PODS
Run your apps Isolated
PODS
A Pod is the basic execution unit of a Kubernetes application–the smallest and simplest unit in the Kubernetes object
model that you create or deploy. A Pod represents processes running on your Cluster.
.https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/
27
Definitions file in YAML
28
Definitions file in YAML
pod-setup.yml
Kind Version
POD v1
Service v1
Deployment apps/v1
Ingress networking.../v1beta1
29
Definitions file in YAML
pod-setup.yml
30
Definitions file in YAML
pod-setup.yml
31
pod-setup.yml
32
pod-setup.yml
33
Create and get POD Info
34
Deatailed POD Info
35
Get & EDIT POD
36
2
Service
Connect with or To your POD
SERVICE
Way to expose an application running on a
set of Pods as a network service.
Similar to Load Balancers
38
SERVICE
39
SERVICE
40
SERVICE
41
Setup with Kops
42
Service | NodePort
43
Service | NodePort
44
SERVICE
NODEPort
45
SERVICE
NODEPort
46
Service | ClusterIP
Service | ClusterIP
NodePort & ClusterIP
NODEPort
ClusterIP
ClusterIP
49
Service | LoadBalancer
LoadBalancer & ClusterIP
3
Replication Controller
Keep your running all the TIME
Replication Controller
● Pods maintained by a ReplicationController are automatically replaced if
they fail, are deleted, or are terminated
● If there are too many pods, the ReplicationController terminates the extra
pods.
53
POD without Replication Controller
POD without Replication Controller
POD without Replication Controller
POD with Replication Controller
Scaling with Replication Controller
Replication Controller Definition
Replication Controller Definition
Create & View RC
Edit & Scale RC
ReplicaSet
Maintain Pod Replica
Replicaset
● A ReplicaSet's purpose is to maintain a stable set of replica Pods
running at any given time
64
Deployment
Upgrade, RollBack, Changes Gracefully
Deployment
● A Deployment controller provides declarative updates for Pods and
ReplicaSets.
66
Deployment
67
Deployment
Deployment
Deployment | Replication Controller
Create & View Deployment
71
View & Edit Deployment
72
Edit Deployment
73
Namespaces
Group your resources
Connect SVC in Namespaces
78
Use Namespace
79
Command & Arguments
Pass Command & Args to your POD
Command & Entrypoint
FROM ubuntu
docker run printer
CMD [“echo hi”]
81
Command & Entrypoint
FROM ubuntu
ENTRYPOINT[sleep]
CMD [“5”]
ENTRYPOINT[sleep]
CMD [“5”]
82
Environment Variables
Assign Variable Values
Environment Variables
84
Config Maps
Set & Inject Variables/files in POD
Create Config Maps | Imperative
86
Create Config Maps | Declarative
87
POD Reading Config Maps
88
Secrets
Share encoded/encrypted variables to POD
Store and manage sensitive information, such as passwords
Create Secrets | Imperative
90
Create Secrets | Declarative
91
POD Reading Secret
92
Secret as a Volume
93