SlideShare a Scribd company logo
1Confidential │ ©2019 VMware, Inc.
Kubernetes 101
Simone Morellato
Confidential │ ©2019 VMware, Inc. 2
What is Docker?
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Docker Host
Confidential │ ©2019 VMware, Inc. 3
What is Kubernetes?
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Docker Host
Kubernetes Kubelet
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Docker Host
Kubernetes Kubelet
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Docker Host
Kubernetes Kubelet
Kubernetes Master
Confidential │ ©2019 VMware, Inc. 4
What is Kubernetes?
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Kubernetes None
Kubernetes Kubelet
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Kubernetes None
Kubernetes Kubelet
OS
App 1
Bins/Libs
App 2
Bins/Libs
App 3
Bins/Libs
Docker Daemon
Kubernetes None
Kubernetes Kubelet
Kubernetes Master
Confidential │ ©2019 VMware, Inc. 5
Intro to Kubernetes Workloads
Pod: Smaller unit of schedule
Jobs: for apps that run to termination
Cron Jobs: for apps that run on a time schedule
Daemon Sets: for apps that run on each VM/Machine
Deployments: Manage the rollout of new versions of Pods
Replica Sets: for stateless apps that need multiple instances
Stateful Sets: for stateful apps that need multiple instances
CRDs: you teach Kubernetes how to behave
Confidential │ ©2019 VMware, Inc. 6
One or more application containers that
are tightly coupled, sharing network and
storage.
Example: NGINX container and a telegraf container. The
NGINX container is providing you a frontend webpage
and the telegraf container is sending NGINX metrics to
Wavefront for monitoring.
What is a POD?
Smaller unit of schedule
NGINX
Bins/Libs
Telegraf
Bins/Libs
VETH0
172.17.0.2
Confidential │ ©2019 VMware, Inc. 7
How do I run a Pod?
$ cat mywebserver.yaml
apiVersion: v1
kind: pod
metadata:
name: my-webserver
labels:
app: web
spec:
containers:
- name: NGINX
image: "nginx:1.7.9“
- name: TELEGRAF
image: “telegraf:1.9"
$ kubectl create -f mywebserver.yaml
pod "my-webserver" created
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
my-webserver 0/1 Pending 0 15s
NGINX
Bins/Libs
Telegraf
Bins/Libs
Confidential │ ©2019 VMware, Inc. 8
Kuberbetes Pod Phases
• Pending
• The pod has been accepted by the system, but one or more of the container images has not
been created
• Includes time before being scheduled as well as time spent downloading images over the
network
• Running
• The pod has been bound to a node, and all of the containers have been created
• At least one container is still running, or is in the process of starting or restarting
• Succeeded
• All containers in the pod have terminated in success, and will not be restarted
• Failed
• All containers in the pod have terminated, at least one container has terminated in failure
(exited with non-zero exit status or was terminated by the system)
• Unknown
• For some reason the state of the pod could not be obtained, typically due to an error in
communicating with the host of the pod
Confidential │ ©2019 VMware, Inc. 9
for apps that run on each VM/Machine
DaemonSet in Action
Kubernetes Cluster
DaemonSet1.yaml
kind: DaemonSet
containers:
- name: webserver
- image: nginx
Runs a copy of a Pod on every
node in the cluster
Newly created nodes automatically
get the DaemonSet Pod(s)
When a node is removed a
DaemonSet doesn’t get
rescheduled
Node 1
Pod1
Node 2
Pod2
Node 3
Pod3
MasterAPI
K
K
K
Confidential │ ©2019 VMware, Inc. 10
Kubernetes Cluster
Deployment X.yaml
ContainerImage1
Replicas: 3
ContainerImage2
Replicas: 2
Deployments and Replicaset in Action
Node 1
P1R1
Node 2
P1R2 P2R1 P1R1
P2R1
Node 3
P1R3 P2R2 P2R2
MasterAPI
K
K
K
Deployment_Y.yaml
ContainerImage1
Replicas: 1
ContainerImage2
Replicas: 2
P1R1
P1R2
P2R1
Manage the rollout of new versions of stateless apps that need multiple instances
Deployments offer:
• Auto-healing
• Manual Scaling
• Rolling Updates
Confidential │ ©2019 VMware, Inc. 11
StatefulSet in Action
Pod 1 Pod 2 Pod 3
Pod 1 Pod 2 Pod 3
Creates Pods in sequence
Deletes Pods in reverse sequence
for stateful apps that need multiple instances
The way of launching ordered replica’s of
Pods.
Enables running pods in “clustered mode”
• Master/Slave applications
Valuable for applications that require:
• Stable and unique network identifiers
• Stable persistent storage
• Ordered deployment and scaling
Examples
• Zookeeper, Cassandra, etcd, MySQL, etc
Confidential │ ©2019 VMware, Inc. 12
Labels
A Label is a key/value pair attached to
Pods and convey user-defined attributes.
You can then use label selectors to select
Pods with particular Labels and apply
Services or Replication Controllers to
them.
Labels can be attached to objects at
creation time and subsequently added and
modified at any time
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
Allows us to tie components within Kubernetes together
13Confidential │ ©2019 VMware, Inc.
Let’s build an Application
Confidential │ ©2019 VMware, Inc. 14
ReplicaSets
Make sure multiple copies of a pod is running
Replicas: 2
Selector: tier=Frontend
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
ReplicaSet
Confidential │ ©2019 VMware, Inc. 15
Replicas: 2
Selector: tier=Frontend
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
ReplicaSet
Deployments
Declarative orchestration of application roll-out
Deployment
Confidential │ ©2019 VMware, Inc. 16
Replicas: 2
Selector: tier=Frontend
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
NGINX
Bins/Libs
Telegraf
Bins/Libs
Labels:
tier=frontend,
app=myapp
ReplicaSet
Services
Exposing pods based on labels
Deployment
Service
Selectors:
tier=Frontend
app=myapp
Confidential │ ©2019 VMware, Inc. 17
Ingress and Services
Intro to Kubernetes discovery and load balancing
Ingress
Service
app=bacon
Service
app=eggs
/bacon /eggs
https://breakfast.com
Pod 1 Pod 2 Pod 3 Pod 1 Pod 2
Services Types
• ClusterIP: Internal to the K8s
cluster
• NodePort: Open a port on the
host to allow connectivity with
external world
• Loadbalancer: configure an
external LB to allow connectivity
with external world
Ingress: manage external access
to multiple services
Confidential │ ©2019 VMware, Inc. 18
apiVersion: v1
kind: Service
metadata:
name: bacon
spec:
ports:
- port: 80
selector:
app: breakfast
type: LoadBalancer
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: breakfast
spec:
replicas: 2
template:
metadata:
labels:
app: breakfast
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
nginx Pod
app=breakfast
nginx Pod
app=breakfast
bacon-svc
app=breakfast
http 80
http 80 load balanced
Let’s put it all together
Confidential │ ©2019 VMware, Inc. 19
https://url
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: breakfast
spec:
rules:
- http:
paths:
- path: /bacon
backend:
serviceName: bacon-svc
servicePort: 80
- http:
paths:
- path: /eggs
backend:
serviceName: eggs-svc
servicePort: 80
ingress
app=breakfast
breakfast Pod
app= breakfast
bacon-svc
Service
app=bacon
http 80
breakfast Pod
app= breakfast
eggs-svc
Service
app=eggs
http 80
http://url/bacon http://url/eggs
Let’s put it all together
20Confidential │ ©2019 VMware, Inc.
Kubernetes Configuration and
Storage
Confidential │ ©2019 VMware, Inc. 21
A volume Is [effectively] a Directory,
possibly with data in it, available to all
containers in a Pod.
Usually Shares lifecycle of a Pod
(Created when Pod is created, destroyed
when Pod is destroyed).
Persistent Volumes outlive Pods.
Can be mounted from local disk, or from a
network storage device such as a
vSphere Datastore, iSCSI, NFS, etc.
Kubernetes Volume
NGINX
Bins/Libs
Telegraf
Bins/Libs
VETH0
172.17.0.2
Confidential │ ©2019 VMware, Inc. 22
vSphere
Kubelet
Datastore1
K8s Vol
dataVol.vmdk
K8s vSphere
Cloud provider
Kubernetes Worker (VM)
Pod
Tools, Libs, SW
Redis
DB
K8s API
vCenter
Create Storage Class
Create Persistent Vol Claim
Create Pod and Mount Volume
New Pod
Tools, Libs, SW
Redis
DB
Name: thin-disk
Provisioner: vSphere Volume
Diskformat: thin
Name: volume-claim
Storage class: thin-disk
Accessmode: readwrite
Storage: 2GB
Podspec includes:
Persistent volume claim
Filesystem mount point
How do Persistent Volumes work on vSphere
Confidential │ ©2019 VMware, Inc. 23
ConfigMaps decouple configuration artifacts from
image content to keep containerized applications
portable.
Secrets let you store and manage sensitive
information, such as passwords, OAuth tokens,
and ssh keys
ConfigMaps/Secrets (user-data)
Confidential │ ©2019 VMware, Inc. 24
Kubernetes Node (VM)
Kubernetes Pod
In summary
Container – The core application
Pod – Container(s) run inside Pods
Node – Runs Docker Engine & Kubelet
Kubernetes Cluster – Culmination of all components: Control & Data Plane
Stem B
Stem B
Stem B
Stem B
Node
Node
Node
Kubernetes Cluster
Services
API
Kubernetes Pod
App Container
Redis
DB
Tools, Libs, SW
Pod
2
Pod
1
K
Docker
Engine
K
K
K
ESXi
App Container
Redis
DB
Tools, Libs, SW
VM
VM
VM
VM
VMs
Confidential │ ©2019 VMware, Inc. 25
Why developers prefer to use Kubernetes when building cloud-native applications
PKS – Developer Benefits
Self-Healing
Batch
Execution
Intelligent
Scheduling
Service Discovery
& Load Balancing
Storage
Orchestration
Automated Rollouts
& Rollbacks
Horizontal
Scaling
Secret & Config
Management

More Related Content

What's hot (20)

PDF
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
SlideTeam
 
PDF
Zero downtime-java-deployments-with-docker-and-kubernetes
Arjan Schaaf
 
PDF
DCEU 18: Provisioning and Managing Storage for Docker Containers
Docker, Inc.
 
PPTX
Azure dev ops_demo
Abhishek Sahu
 
PDF
DCEU 18: Docker Container Security
Docker, Inc.
 
PDF
DCEU 18: State of the Docker Engine
Docker, Inc.
 
PDF
Social Connections 14 - Kubernetes Basics for Connections Admins
panagenda
 
PDF
Docker for any type of workload and any IT Infrastructure
Docker, Inc.
 
PPSX
Docker Kubernetes Istio
Araf Karsh Hamid
 
PDF
Building Your Docker Swarm Tech Stack
Bret Fisher
 
PPTX
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon
 
PPTX
Introduction to Docker - 2017
Docker, Inc.
 
PPTX
Introduction to Kubernetes
Paul Czarkowski
 
PPTX
What's New in Docker - February 2017
Patrick Chanezon
 
PDF
DCEU 18: Docker for Windows Containers and Kubernetes
Docker, Inc.
 
PDF
From Code to Kubernetes
Daniel Oliveira Filho
 
PPTX
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
PDF
K8scale update-kubecon2015
Bob Wise
 
PDF
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
Daniel Krook
 
PDF
Helm - Package Manager for Kubernetes
Knoldus Inc.
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
SlideTeam
 
Zero downtime-java-deployments-with-docker-and-kubernetes
Arjan Schaaf
 
DCEU 18: Provisioning and Managing Storage for Docker Containers
Docker, Inc.
 
Azure dev ops_demo
Abhishek Sahu
 
DCEU 18: Docker Container Security
Docker, Inc.
 
DCEU 18: State of the Docker Engine
Docker, Inc.
 
Social Connections 14 - Kubernetes Basics for Connections Admins
panagenda
 
Docker for any type of workload and any IT Infrastructure
Docker, Inc.
 
Docker Kubernetes Istio
Araf Karsh Hamid
 
Building Your Docker Swarm Tech Stack
Bret Fisher
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon
 
Introduction to Docker - 2017
Docker, Inc.
 
Introduction to Kubernetes
Paul Czarkowski
 
What's New in Docker - February 2017
Patrick Chanezon
 
DCEU 18: Docker for Windows Containers and Kubernetes
Docker, Inc.
 
From Code to Kubernetes
Daniel Oliveira Filho
 
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
K8scale update-kubecon2015
Bob Wise
 
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
Daniel Krook
 
Helm - Package Manager for Kubernetes
Knoldus Inc.
 

Similar to Kubernetes 101 VMworld 2019 workshop slides (20)

PDF
Digital Forensics and Incident Response in The Cloud Part 3
Velocidex Enterprises
 
PPTX
Kubernetes for the VI Admin
Kendrick Coleman
 
PDF
Container and Cloud Native Application: What is VMware doing in this space? -...
gguglie
 
PDF
Dockers zero to hero
Nicolas De Loof
 
PPTX
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
PPTX
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
PDF
Cluster management with Kubernetes
Satnam Singh
 
PPTX
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Van Phuc
 
PPTX
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
PPT
Linux containers and docker
Fabio Fumarola
 
PDF
Bare-metal, Docker Containers, and Virtualization: The Growing Choices for Cl...
Odinot Stanislas
 
PPTX
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Patrick Chanezon
 
PPTX
Detailed Introduction To Docker
nklmish
 
PDF
Kubernetes Clusters as a Service with Gardener
QAware GmbH
 
PDF
Unikernels: Rise of the Library Hypervisor
Anil Madhavapeddy
 
PPT
2 Linux Container and Docker
Fabio Fumarola
 
PDF
Unikernels: the rise of the library hypervisor in MirageOS
Docker, Inc.
 
PPTX
Container BoM Inspection with TERN
Open Source Technology Center MeetUps
 
PDF
Continuous Delivery the hard way with Kubernetes
Luke Marsden
 
PPTX
Continuous Delivery the Hard Way with Kubernetes
Weaveworks
 
Digital Forensics and Incident Response in The Cloud Part 3
Velocidex Enterprises
 
Kubernetes for the VI Admin
Kendrick Coleman
 
Container and Cloud Native Application: What is VMware doing in this space? -...
gguglie
 
Dockers zero to hero
Nicolas De Loof
 
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
Cluster management with Kubernetes
Satnam Singh
 
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Van Phuc
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Patrick Chanezon
 
Linux containers and docker
Fabio Fumarola
 
Bare-metal, Docker Containers, and Virtualization: The Growing Choices for Cl...
Odinot Stanislas
 
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Patrick Chanezon
 
Detailed Introduction To Docker
nklmish
 
Kubernetes Clusters as a Service with Gardener
QAware GmbH
 
Unikernels: Rise of the Library Hypervisor
Anil Madhavapeddy
 
2 Linux Container and Docker
Fabio Fumarola
 
Unikernels: the rise of the library hypervisor in MirageOS
Docker, Inc.
 
Container BoM Inspection with TERN
Open Source Technology Center MeetUps
 
Continuous Delivery the hard way with Kubernetes
Luke Marsden
 
Continuous Delivery the Hard Way with Kubernetes
Weaveworks
 
Ad

More from Simone Morellato (8)

PPTX
Run Stateful Apps on Kubernetes with VMware PKS - Highlight WebLogic Server
Simone Morellato
 
PPTX
CMP, Containers Orchestrator, PaaS landscape explained in one slide
Simone Morellato
 
PPTX
VMs and Containers - Friends or Enemies
Simone Morellato
 
PPTX
vSphere Integrated Containers 101 and End-User Workflow
Simone Morellato
 
PPTX
How did we get to Containers: A brief History of Computing
Simone Morellato
 
PDF
ApceraPlatformFeatures_WP
Simone Morellato
 
PPTX
Docker & Apcera Better Together
Simone Morellato
 
PPTX
IDC Directions March 2014 Key Take-Aways
Simone Morellato
 
Run Stateful Apps on Kubernetes with VMware PKS - Highlight WebLogic Server
Simone Morellato
 
CMP, Containers Orchestrator, PaaS landscape explained in one slide
Simone Morellato
 
VMs and Containers - Friends or Enemies
Simone Morellato
 
vSphere Integrated Containers 101 and End-User Workflow
Simone Morellato
 
How did we get to Containers: A brief History of Computing
Simone Morellato
 
ApceraPlatformFeatures_WP
Simone Morellato
 
Docker & Apcera Better Together
Simone Morellato
 
IDC Directions March 2014 Key Take-Aways
Simone Morellato
 
Ad

Recently uploaded (20)

PDF
10 Salesforce Consulting Companies in Sydney.pdf
DianApps Technologies
 
PDF
How to get the licensing right for Microsoft Core Infrastructure Server Suite...
Q-Advise
 
PDF
Message Level Status (MLS): The Instant Feedback Mechanism for UAE e-Invoicin...
Prachi Desai
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PDF
Show Which Projects Support Your Strategy and Deliver Results with OnePlan df
OnePlan Solutions
 
PDF
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
PDF
Optimizing Tiered Storage for Low-Latency Real-Time Analytics at AI Scale
Alluxio, Inc.
 
PDF
Salesforce Experience Cloud Consultant.pdf
VALiNTRY360
 
PDF
Introduction to Apache Iceberg™ & Tableflow
Alluxio, Inc.
 
PDF
Understanding the EU Cyber Resilience Act
ICS
 
PPT
24-BuildingGUIs Complete Materials in Java.ppt
javidmiakhil63
 
PDF
Notification System for Construction Logistics Application
Safe Software
 
PDF
Softaken CSV to vCard Converter accurately converts CSV files to vCard
markwillsonmw004
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PDF
How AI in Healthcare Apps Can Help You Enhance Patient Care?
Lilly Gracia
 
PPTX
How Can Reporting Tools Improve Marketing Performance.pptx
Varsha Nayak
 
PPTX
How Odoo ERP Enhances Operational Visibility Across Your Organization.pptx
pintadoxavier667
 
PDF
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
PDF
Windows 10 Professional Preactivated.pdf
asghxhsagxjah
 
PPTX
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 
10 Salesforce Consulting Companies in Sydney.pdf
DianApps Technologies
 
How to get the licensing right for Microsoft Core Infrastructure Server Suite...
Q-Advise
 
Message Level Status (MLS): The Instant Feedback Mechanism for UAE e-Invoicin...
Prachi Desai
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
Show Which Projects Support Your Strategy and Deliver Results with OnePlan df
OnePlan Solutions
 
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
Optimizing Tiered Storage for Low-Latency Real-Time Analytics at AI Scale
Alluxio, Inc.
 
Salesforce Experience Cloud Consultant.pdf
VALiNTRY360
 
Introduction to Apache Iceberg™ & Tableflow
Alluxio, Inc.
 
Understanding the EU Cyber Resilience Act
ICS
 
24-BuildingGUIs Complete Materials in Java.ppt
javidmiakhil63
 
Notification System for Construction Logistics Application
Safe Software
 
Softaken CSV to vCard Converter accurately converts CSV files to vCard
markwillsonmw004
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
How AI in Healthcare Apps Can Help You Enhance Patient Care?
Lilly Gracia
 
How Can Reporting Tools Improve Marketing Performance.pptx
Varsha Nayak
 
How Odoo ERP Enhances Operational Visibility Across Your Organization.pptx
pintadoxavier667
 
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
Windows 10 Professional Preactivated.pdf
asghxhsagxjah
 
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 

Kubernetes 101 VMworld 2019 workshop slides

  • 1. 1Confidential │ ©2019 VMware, Inc. Kubernetes 101 Simone Morellato
  • 2. Confidential │ ©2019 VMware, Inc. 2 What is Docker? OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Docker Host
  • 3. Confidential │ ©2019 VMware, Inc. 3 What is Kubernetes? OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Docker Host Kubernetes Kubelet OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Docker Host Kubernetes Kubelet OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Docker Host Kubernetes Kubelet Kubernetes Master
  • 4. Confidential │ ©2019 VMware, Inc. 4 What is Kubernetes? OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Kubernetes None Kubernetes Kubelet OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Kubernetes None Kubernetes Kubelet OS App 1 Bins/Libs App 2 Bins/Libs App 3 Bins/Libs Docker Daemon Kubernetes None Kubernetes Kubelet Kubernetes Master
  • 5. Confidential │ ©2019 VMware, Inc. 5 Intro to Kubernetes Workloads Pod: Smaller unit of schedule Jobs: for apps that run to termination Cron Jobs: for apps that run on a time schedule Daemon Sets: for apps that run on each VM/Machine Deployments: Manage the rollout of new versions of Pods Replica Sets: for stateless apps that need multiple instances Stateful Sets: for stateful apps that need multiple instances CRDs: you teach Kubernetes how to behave
  • 6. Confidential │ ©2019 VMware, Inc. 6 One or more application containers that are tightly coupled, sharing network and storage. Example: NGINX container and a telegraf container. The NGINX container is providing you a frontend webpage and the telegraf container is sending NGINX metrics to Wavefront for monitoring. What is a POD? Smaller unit of schedule NGINX Bins/Libs Telegraf Bins/Libs VETH0 172.17.0.2
  • 7. Confidential │ ©2019 VMware, Inc. 7 How do I run a Pod? $ cat mywebserver.yaml apiVersion: v1 kind: pod metadata: name: my-webserver labels: app: web spec: containers: - name: NGINX image: "nginx:1.7.9“ - name: TELEGRAF image: “telegraf:1.9" $ kubectl create -f mywebserver.yaml pod "my-webserver" created $ kubectl get pod NAME READY STATUS RESTARTS AGE my-webserver 0/1 Pending 0 15s NGINX Bins/Libs Telegraf Bins/Libs
  • 8. Confidential │ ©2019 VMware, Inc. 8 Kuberbetes Pod Phases • Pending • The pod has been accepted by the system, but one or more of the container images has not been created • Includes time before being scheduled as well as time spent downloading images over the network • Running • The pod has been bound to a node, and all of the containers have been created • At least one container is still running, or is in the process of starting or restarting • Succeeded • All containers in the pod have terminated in success, and will not be restarted • Failed • All containers in the pod have terminated, at least one container has terminated in failure (exited with non-zero exit status or was terminated by the system) • Unknown • For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod
  • 9. Confidential │ ©2019 VMware, Inc. 9 for apps that run on each VM/Machine DaemonSet in Action Kubernetes Cluster DaemonSet1.yaml kind: DaemonSet containers: - name: webserver - image: nginx Runs a copy of a Pod on every node in the cluster Newly created nodes automatically get the DaemonSet Pod(s) When a node is removed a DaemonSet doesn’t get rescheduled Node 1 Pod1 Node 2 Pod2 Node 3 Pod3 MasterAPI K K K
  • 10. Confidential │ ©2019 VMware, Inc. 10 Kubernetes Cluster Deployment X.yaml ContainerImage1 Replicas: 3 ContainerImage2 Replicas: 2 Deployments and Replicaset in Action Node 1 P1R1 Node 2 P1R2 P2R1 P1R1 P2R1 Node 3 P1R3 P2R2 P2R2 MasterAPI K K K Deployment_Y.yaml ContainerImage1 Replicas: 1 ContainerImage2 Replicas: 2 P1R1 P1R2 P2R1 Manage the rollout of new versions of stateless apps that need multiple instances Deployments offer: • Auto-healing • Manual Scaling • Rolling Updates
  • 11. Confidential │ ©2019 VMware, Inc. 11 StatefulSet in Action Pod 1 Pod 2 Pod 3 Pod 1 Pod 2 Pod 3 Creates Pods in sequence Deletes Pods in reverse sequence for stateful apps that need multiple instances The way of launching ordered replica’s of Pods. Enables running pods in “clustered mode” • Master/Slave applications Valuable for applications that require: • Stable and unique network identifiers • Stable persistent storage • Ordered deployment and scaling Examples • Zookeeper, Cassandra, etcd, MySQL, etc
  • 12. Confidential │ ©2019 VMware, Inc. 12 Labels A Label is a key/value pair attached to Pods and convey user-defined attributes. You can then use label selectors to select Pods with particular Labels and apply Services or Replication Controllers to them. Labels can be attached to objects at creation time and subsequently added and modified at any time NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp Allows us to tie components within Kubernetes together
  • 13. 13Confidential │ ©2019 VMware, Inc. Let’s build an Application
  • 14. Confidential │ ©2019 VMware, Inc. 14 ReplicaSets Make sure multiple copies of a pod is running Replicas: 2 Selector: tier=Frontend NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp ReplicaSet
  • 15. Confidential │ ©2019 VMware, Inc. 15 Replicas: 2 Selector: tier=Frontend NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp ReplicaSet Deployments Declarative orchestration of application roll-out Deployment
  • 16. Confidential │ ©2019 VMware, Inc. 16 Replicas: 2 Selector: tier=Frontend NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp NGINX Bins/Libs Telegraf Bins/Libs Labels: tier=frontend, app=myapp ReplicaSet Services Exposing pods based on labels Deployment Service Selectors: tier=Frontend app=myapp
  • 17. Confidential │ ©2019 VMware, Inc. 17 Ingress and Services Intro to Kubernetes discovery and load balancing Ingress Service app=bacon Service app=eggs /bacon /eggs https://breakfast.com Pod 1 Pod 2 Pod 3 Pod 1 Pod 2 Services Types • ClusterIP: Internal to the K8s cluster • NodePort: Open a port on the host to allow connectivity with external world • Loadbalancer: configure an external LB to allow connectivity with external world Ingress: manage external access to multiple services
  • 18. Confidential │ ©2019 VMware, Inc. 18 apiVersion: v1 kind: Service metadata: name: bacon spec: ports: - port: 80 selector: app: breakfast type: LoadBalancer apiVersion: apps/v1beta1 kind: Deployment metadata: name: breakfast spec: replicas: 2 template: metadata: labels: app: breakfast spec: containers: - image: nginx name: nginx ports: - containerPort: 80 nginx Pod app=breakfast nginx Pod app=breakfast bacon-svc app=breakfast http 80 http 80 load balanced Let’s put it all together
  • 19. Confidential │ ©2019 VMware, Inc. 19 https://url apiVersion: extensions/v1beta1 kind: Ingress metadata: name: breakfast spec: rules: - http: paths: - path: /bacon backend: serviceName: bacon-svc servicePort: 80 - http: paths: - path: /eggs backend: serviceName: eggs-svc servicePort: 80 ingress app=breakfast breakfast Pod app= breakfast bacon-svc Service app=bacon http 80 breakfast Pod app= breakfast eggs-svc Service app=eggs http 80 http://url/bacon http://url/eggs Let’s put it all together
  • 20. 20Confidential │ ©2019 VMware, Inc. Kubernetes Configuration and Storage
  • 21. Confidential │ ©2019 VMware, Inc. 21 A volume Is [effectively] a Directory, possibly with data in it, available to all containers in a Pod. Usually Shares lifecycle of a Pod (Created when Pod is created, destroyed when Pod is destroyed). Persistent Volumes outlive Pods. Can be mounted from local disk, or from a network storage device such as a vSphere Datastore, iSCSI, NFS, etc. Kubernetes Volume NGINX Bins/Libs Telegraf Bins/Libs VETH0 172.17.0.2
  • 22. Confidential │ ©2019 VMware, Inc. 22 vSphere Kubelet Datastore1 K8s Vol dataVol.vmdk K8s vSphere Cloud provider Kubernetes Worker (VM) Pod Tools, Libs, SW Redis DB K8s API vCenter Create Storage Class Create Persistent Vol Claim Create Pod and Mount Volume New Pod Tools, Libs, SW Redis DB Name: thin-disk Provisioner: vSphere Volume Diskformat: thin Name: volume-claim Storage class: thin-disk Accessmode: readwrite Storage: 2GB Podspec includes: Persistent volume claim Filesystem mount point How do Persistent Volumes work on vSphere
  • 23. Confidential │ ©2019 VMware, Inc. 23 ConfigMaps decouple configuration artifacts from image content to keep containerized applications portable. Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys ConfigMaps/Secrets (user-data)
  • 24. Confidential │ ©2019 VMware, Inc. 24 Kubernetes Node (VM) Kubernetes Pod In summary Container – The core application Pod – Container(s) run inside Pods Node – Runs Docker Engine & Kubelet Kubernetes Cluster – Culmination of all components: Control & Data Plane Stem B Stem B Stem B Stem B Node Node Node Kubernetes Cluster Services API Kubernetes Pod App Container Redis DB Tools, Libs, SW Pod 2 Pod 1 K Docker Engine K K K ESXi App Container Redis DB Tools, Libs, SW VM VM VM VM VMs
  • 25. Confidential │ ©2019 VMware, Inc. 25 Why developers prefer to use Kubernetes when building cloud-native applications PKS – Developer Benefits Self-Healing Batch Execution Intelligent Scheduling Service Discovery & Load Balancing Storage Orchestration Automated Rollouts & Rollbacks Horizontal Scaling Secret & Config Management