SlideShare a Scribd company logo
Kubernetes
Aditya Goel
Agenda
• Kubernetes
✓Introduction
✓Architecture
✓Components
✓Hands-On Demo
Kubernetes
• Open source container orchestration tool
• Developed by Google
• Helps manage containerized applications
Official definition of Kubernetes:
Why Kubernetes?
• What Problems does Kubernetes solve?
• What are the tasks of an orchestration tool?
Why Kubernetes?
• Trend from Monolithic arch to Micro-Services arch
Need for container orchestration tool
App App
App
App
App
Micro Service A
Micro Service B
Micro Service C
Micro Service E
Micro Service D
Mod 1 Mod 2
Mod 3 Mod 4
App
Monolithic
Kubernetes - Features
• High Availability or no downtime
• Scalability or high performance
• Disaster recovery – backup and restore
What features do orchestration tools offer?
Kubernetes - Architecture
Node Node Node
Control Plane
Primary “node” agent
Kubernetes - Architecture
Node Node Node
Control Plane
Primary “node” agent
Kubernetes - Processes
API Server: Entry-point to K8s cluster
Control
Plane
CLI
API
UI
API SERVER
Kubernetes - Processes
API Server: Entry-point to K8s cluster
Control
Plane
Controller Manager
Scheduler
Controller manager: keeps track of whats
happening in the cluster
Scheduler: ensure pods placement
API SERVER
30% used 70% used
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Kubernetes - Processes
API Server: Entry-point to K8s cluster
Controller manager: keeps track of whats
happening in the cluster
Scheduler: ensure pods placement
etcd: Kubernetes backing store
Kubernetes - Processes
Virtual Network: creates one unified machine
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Virtual Network
Kubernetes – Master Redundancy
Control Plane Nodes
Handful of master processes
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Worker Nodes
Higher workload
Much bigger and more resources
Kubernetes – Master Redundancy
Control Plane Nodes
Handful of master processes
Much more important
Worker Nodes
Higher workload
Much bigger and more resources
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Kubernetes Components
• Pod
• Service
• Ingress
• ConfirgMap
• Secret
• Deployment
• StatefulSet
Pod
• Smallest unit of Kubernetes
• Abstraction over container
• Usually 1 application per pod
• Each pod gets its own IP address
• New IP address on re-creation
Node
IP
IP
MY-APP
Service
• Permanent IP address
• Lifecycle of Pod and Service not connected
Node
IP
SERVICE
MY-APP
Service
http://node-ip:port
App should be accessible through browser
Node
IP
SERVICE
MY-APP
EXTERNAL SERVICE
DB SERVICE
Service
http://node-ip:port
App should be accessible through browser
Node
IP
SERVICE
MY-APP
EXTERNAL SERVICE
DB SERVICE
http://db-service-ip:port
INTERNAL SERVICE
Service
http://124.89.101.2:8080
App should be accessible through browser
Node
IP
SERVICE
MY-APP
EXTERNAL SERVICE
DB SERVICE
http://db-service-ip:port
INTERNAL SERVICE
Ingress
http://my-app.com
App should be accessible through browser
Node
IP
SERVICE
MY-APP
INGRESS
DB SERVICE
INGRESS
Component?
Database URL usually in the built application!!
Node
IP
SERVICE
MY-APP
DB SERVICE
INGRESS
Pull it in to the Pod
Push it to repo
Re-Build
Mongo-DB
ConfigMap
ConfigMap is for non-confidential data only!
Database URL usually in the built application!!
Node
IP
SERVICE
MY-APP
DB SERVICE
ConfigMap
Mongo-DB
Mongo-user
Mongo-pwd
DB_URL = Mongo-DB
Map map = new HashMap<>();
map.put(“DB_URL”, “http://mongoDB.jswsteel.vasind.bits.edu”);
map.put(“WS_EndPoint”, “http://weatherforecastingdata.gov.in”);
map.put(“NumberOfThreadsAllowed”, 10);
Secret
Used to store secret data
Reference Secret in Deployment
Node
IP
SERVICE
MY-APP
DB SERVICE
ConfigMap
Mongo-DB
Mongo-user
Mongo-pwd
DB_URL = Mongo-DB
Secret
DB_USER = mongo-user
DB_PWD = mongo pwd
Vol
Storage on local machine
Or remote, outside the K8s cluster
PS: Kubernetes does not manage data persistence
Storage
Node
IP
SERVICE
MY-APP
DB
SERVICE
INGRESS
Vol
remote
local
Deployment??
http://node-ip:port
App should be accessible through browser
Node
IP
SERVICE
MY-APP
EXTERNAL SERVICE
DB SERVICE
Deployment??
http://node-ip:port
Permanent IP
Load balancer
Node
IP
SERVICE
MY-APP
EXTERNAL SERVICE
DB
SERVICE
Node
IP
SERVICE
MY-APP
Deployment
Blueprint for “MY-APP” Pods
Create “Deployments”
Node
IP
SERVICE
MY-APP
DB
SERVICE
Node
IP
SERVICE
MY-APP
Deployment
DB can not be replicated via Deployment
Node
IP
SERVICE
MY-APP
DB
SERVICE
Node
IP
SERVICE
MY-APP
DB
Deployment
DB can not be replicated via Deployment
Node
IP
SERVICE
MY-APP
DB
SERVICE
Node
IP
SERVICE
MY-APP
DB
StatefulSet
For Stateful apps
Node
IP
SERVICE
MY-APP
DB
SERVICE
Node
IP
SERVICE
MY-APP
DB
Deployment for Stateless apps
StatefulSet for StateFUL apps or databases
Node
IP
SERVICE
MY-APP
DB
SERVICE
Node
IP
SERVICE
MY-APP
DB
Kubernetes - Configuration
• JSON
• YAML
API Server: Entry-point to K8s cluster
Control
Plane
CLI
API
UI
API SERVER
Kubernetes - Configuration
• Declarative
• Is == Should
API Server: Entry-point to K8s cluster
Control
Plane
CLI
API
UI
API SERVER
Controller Manager
Controller Manager checks:
Desired state == actual state?
Kubernetes Configuration
• Each Configuration file has 3 parts:
• Metadata
• Specification
• Status
Deployment Service
Kubernetes Configuration
• Each Configuration file has 3 parts:
• Metadata
• Specification
• Status
Deployment Service
Attributes of
“Spec” are specific
to the “kind”
Kubernetes Configuration
• Each Configuration file has 3 parts:
• Metadata
• Specification
• Status : K8s updates the state continously
Deployment Desired? Vs Actual?
Control
Plane
Controller Manager
Scheduler
API SERVER
etcd
Where does K8s get this status data?
API Server: Entry-point to K8s cluster
Controller manager: keeps track of whats
happening in the cluster
Scheduler: ensure pods placement
etcd: Kubernetes backing store
Provides the Status information
Production Cluster
• Multiple Master and Worker nodes
• Separate Virtual or Physical machines
Test/Local Cluster Setup
• Master and Node processes run on One machine
• Minikube
• Micro K8s
mongo-configmap.yaml and mongo-secret.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: mongo-config
data:
mongo-url: mongo-service
apiVersion: v1
kind: Secret
metadata:
name: mongo-secret
type: Opaque
data:
mongo-user: bW9uZ291c2Vy
mongo-password: bW9uZ29wYXNzd29yZA==
Mongo.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo-deployment
labels:
app: mongo
spec:
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongodb
image: mongo:5.0
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo-user
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo-password
---
apiVersion: v1
kind: Service
metadata:
name: mongo-service
spec:
selector:
app: mongo
ports:
- protocol: TCP
port: 27017
targetPort: 27017
Webapp.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp-deployment
labels:
app: webapp
spec:
replicas: 1
selector:
matchLabels:
app: webapp
template:
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
image: nanajanashia/k8s-demo-app:v1.0
ports:
- containerPort: 3000
env:
- name: USER_NAME
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo-user
- name: USER_PWD
valueFrom:
secretKeyRef:
name: mongo-secret
key: mongo-password
- name: DB_URL
valueFrom:
configMapKeyRef:
name: mongo-config
key: mongo-url
---
apiVersion: v1
kind: Service
metadata:
name: webapp-service
spec:
type: NodePort
selector:
app: webapp
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30100
• Kubectl get node
• Kubectl apply –f mongo-configmap.yaml
• Like wise apply – mongo-secret.yaml, mongo.yaml, webapp.yaml
• Kubectl get deployments
• Kubectl get pods
• Kubectl get services
• Kubectl get all
• Kubectl describe service webapp-service
• Kubectl delete service <service-name>
• Kubectl delete deployment <deployment-name>
• Kubectl delete configmap <configmap name>
• Kubectl delete secret <secret-name>
Use private IP of any of the nodes to access the app!!

More Related Content

PDF
Kubernetes
Sang-Min Park
 
PPTX
Kubernetes Introduction
Miloš Zubal
 
PDF
Kubernetes
Diego Pacheco
 
PPTX
Kubernetes
Lhouceine OUHAMZA
 
PDF
Kubernetes for the PHP developer
Paul Czarkowski
 
PDF
Kubernetes intro
Pravin Magdum
 
PDF
FIWARE Global Summit - Leveraging Kubernetes for FIWARE Components Automations
FIWARE
 
PPTX
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
MongoDB
 
Kubernetes
Sang-Min Park
 
Kubernetes Introduction
Miloš Zubal
 
Kubernetes
Diego Pacheco
 
Kubernetes
Lhouceine OUHAMZA
 
Kubernetes for the PHP developer
Paul Czarkowski
 
Kubernetes intro
Pravin Magdum
 
FIWARE Global Summit - Leveraging Kubernetes for FIWARE Components Automations
FIWARE
 
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
MongoDB
 

Similar to Kubernetes for Cloud-Native Environments (20)

PPTX
Kubernetes 101
Stanislav Pogrebnyak
 
PDF
Kubernetes: My BFF
Jonathan Yu
 
PPTX
Jenkins_K8s (2).pptx
khalil Ismail
 
PDF
MongoDB Ops Manager + Kubernetes
MongoDB
 
PDF
DEVOPS UNIT 4 docker and services commands
billuandtanya
 
PDF
Intro to Kubernetes
Joonathan Mägi
 
PPTX
Introduction to kubernetes
Rishabh Indoria
 
PDF
Kubernetes From Scratch .pdf
ssuser9b44c7
 
PDF
Docker & kubernetes
NexThoughts Technologies
 
PPTX
DevOps with Kubernetes
EastBanc Tachnologies
 
PDF
Running and Managing Kubernetes on OpenStack
Victor Palma
 
PDF
prodops.io k8s presentation
Prodops.io
 
PDF
A DevOps guide to Kubernetes
Paul Czarkowski
 
PDF
DevOps in AWS with Kubernetes
Oleg Chunikhin
 
PDF
Kubernetes for Beginners
DigitalOcean
 
PDF
Kubernetes Basics - ICP Workshop Batch II
PT Datacomm Diangraha
 
PDF
Kubernetes for Java developers
Robert Barr
 
PPTX
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
PDF
ContainerDayVietnam2016: Kubernetes State-of-the-art Container Management Pla...
Docker-Hanoi
 
PDF
Kubernetes basics, Nodes, Pods, Containers, Deployments
Beroza Paul
 
Kubernetes 101
Stanislav Pogrebnyak
 
Kubernetes: My BFF
Jonathan Yu
 
Jenkins_K8s (2).pptx
khalil Ismail
 
MongoDB Ops Manager + Kubernetes
MongoDB
 
DEVOPS UNIT 4 docker and services commands
billuandtanya
 
Intro to Kubernetes
Joonathan Mägi
 
Introduction to kubernetes
Rishabh Indoria
 
Kubernetes From Scratch .pdf
ssuser9b44c7
 
Docker & kubernetes
NexThoughts Technologies
 
DevOps with Kubernetes
EastBanc Tachnologies
 
Running and Managing Kubernetes on OpenStack
Victor Palma
 
prodops.io k8s presentation
Prodops.io
 
A DevOps guide to Kubernetes
Paul Czarkowski
 
DevOps in AWS with Kubernetes
Oleg Chunikhin
 
Kubernetes for Beginners
DigitalOcean
 
Kubernetes Basics - ICP Workshop Batch II
PT Datacomm Diangraha
 
Kubernetes for Java developers
Robert Barr
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
ContainerDayVietnam2016: Kubernetes State-of-the-art Container Management Pla...
Docker-Hanoi
 
Kubernetes basics, Nodes, Pods, Containers, Deployments
Beroza Paul
 
Ad

Recently uploaded (20)

PDF
4th Industrial Revolution, Transition Period and Sectors
Sazzad Hossain Riju
 
PPTX
Healing Routine Presentation.exercisepptx
eman youssif
 
PDF
The Architecture of Change: Why Frameworks Outperform Willpower in Therapy
Identity Growth Journal
 
PPTX
Holistic Development Role of Edu v5.pptx
ssusera15ea5
 
PPTX
Self-Care Toolbox.advices and developmentpptx
eman youssif
 
PDF
Manual-of-Guerilla-Tactics To Protect You
bawga
 
PDF
Nep english aecc-2 about reading techniques
moharananilakantha87
 
PPTX
The Journey of Self Refinement and self improvement
Muhammad Musawar Ali
 
PDF
The Human Edge: Why A.I. Can’t Steal Your Story!
vijitsrivastava083
 
PPTX
Combining Writing, Art, And Affirmations.pptx
eman youssif
 
PPTX
Understanding Motivational Theories.pptx
dinalisanjala002
 
PPTX
Understanding Value Education_Lect2.pptx
ssusera15ea5
 
PPTX
Discipline and Positive Behaviour Plan for A Great Day
DarmawanAmbari2
 
PPTX
Your Personal Growth Journal journaling.pptx
eman youssif
 
PPTX
Healing Portfolio Presentation.exercisepptx
eman youssif
 
PDF
Quarterly project_20250727_112257_0000.pdf
monteroemilia873
 
PPTX
Skincare: Know Your Skin, Build Your Routine
khushish167
 
PDF
Despre calibrare: O abordare structurată
Răzvan Deaconescu
 
PDF
Omica Pageant 2025- Premier beauty pageant platform
OmicaPageant
 
PPT
Life Skill_https://www.scribd.com/archive/plans?slideshare=true.ppt
machonvicoti
 
4th Industrial Revolution, Transition Period and Sectors
Sazzad Hossain Riju
 
Healing Routine Presentation.exercisepptx
eman youssif
 
The Architecture of Change: Why Frameworks Outperform Willpower in Therapy
Identity Growth Journal
 
Holistic Development Role of Edu v5.pptx
ssusera15ea5
 
Self-Care Toolbox.advices and developmentpptx
eman youssif
 
Manual-of-Guerilla-Tactics To Protect You
bawga
 
Nep english aecc-2 about reading techniques
moharananilakantha87
 
The Journey of Self Refinement and self improvement
Muhammad Musawar Ali
 
The Human Edge: Why A.I. Can’t Steal Your Story!
vijitsrivastava083
 
Combining Writing, Art, And Affirmations.pptx
eman youssif
 
Understanding Motivational Theories.pptx
dinalisanjala002
 
Understanding Value Education_Lect2.pptx
ssusera15ea5
 
Discipline and Positive Behaviour Plan for A Great Day
DarmawanAmbari2
 
Your Personal Growth Journal journaling.pptx
eman youssif
 
Healing Portfolio Presentation.exercisepptx
eman youssif
 
Quarterly project_20250727_112257_0000.pdf
monteroemilia873
 
Skincare: Know Your Skin, Build Your Routine
khushish167
 
Despre calibrare: O abordare structurată
Răzvan Deaconescu
 
Omica Pageant 2025- Premier beauty pageant platform
OmicaPageant
 
Life Skill_https://www.scribd.com/archive/plans?slideshare=true.ppt
machonvicoti
 
Ad

Kubernetes for Cloud-Native Environments