Introduction to Kubernetes

Logical Kubernetes Architecture
API Server
Kube Scheduler
K8s Master
Controller
Manager
Etcd
Kubelet
Kube-proxy
K8s Worker
Pod
Pod
Pod
K8s Worker
Pod
Pod
Pod
K8s Worker
Pod
Pod
Pod
CNI CNI CNI
Docker
Kubelet
Kube-proxy
Docker
Kubelet
Kube-proxy
Docker
RESOURCES
POD
Container
Container
Pod
Pod
one or more application containers that are tightly
coupled, sharing network and storage.
Example: a web front-end Pod that consists of an NGINX
container and a PHP-FPM container with a shared unix socket
and a “init” container to transform their config files based on
environment variables.
Container
Container
Pod
ReplicaSet
Extends Pod resource to run and maintain a specific
number of copies of a pod.
Container
Container
Pod
ReplicaSet
Container
Container
Pod
Deployment
a controller that ensures a set number of replicas of
a Pod is running and provides update and upgrade
workflows for your Pods.
Example: cloud native Node app that scales horizontally and
upgrades 2 pods at a time.
Container
Container
Pod
ReplicaSet
Deployment
Container
Container
Pod
statefulset
a controller that manages stateful application
Deployments by providing sticky identity for pods
and strict ordering and uniqueness.
Example: Cassandra database. First pod is ‘cassandra-0’ thus
all other pods in the set can be told to cluster to ‘cassandra-0’
and it will form a ring, plus the storage will survive pod
restarts.
Container
Container
Pod
ReplicaSet
Deployment
Statefulset
Volume
Container
Container
Pod
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 EBS volume, iscsi, NFS, etc.
Service
Service
track Pods based on metadata and provides
connectivity and service discovery (DNS, Env
variables) for them.
Type
ClusterIP (default) exposes service on a cluster-
internal IP.
Container
Container
Pod
app=bacon
Container
Container
Pod
app=bacon
Service
app=bacon 10.3.55.7
Service
track Pods based on metadata and provides
connectivity and service discovery (DNS, Env
variables) for them.
Type
NodePort extends ClusterIP to expose services on
each node’s IP via a static port.
Container
Container
Pod
app=bacon
Container
Container
Pod
app=bacon
Service
app=bacon 10.3.55.7
192.168.0.5:4530
K8s Worker K8s Worker
192.168.0.6:4530
Service
track Pods based on metadata and provides
connectivity and service discovery (DNS, Env
variables) for them.
Type
LoadBalancer extends NodePort to configure a cloud
provider’s load balancer using the cloud-controller-
manager.
Container
Container
Pod
app=bacon
Container
Container
Pod
app=bacon
Service
app=bacon 10.3.55.7
192.168.0.5:4530
K8s Worker K8s Worker
192.168.0.6:4530
Load Balancer
33.6.5.22:80
Ingress
a controller that manages an external entity to provide
load balancing, SSL termination and name-based
virtual hosting to services based on a set of rules.
Ingress
Service
app=bacon
https://example.com
Service
app=eggs
/bacon eggs
Config Map / Secret
Provides key-value pairs to be injected into a pod much like user-data is injected into a Virtual
Machine in the cloud.
Allows you to do last minute configuration of applications running on Kubernetes such as
setting a database host, or a admin password.
ConfigMaps store values as strings, Secrets store them as byte arrays (serialized as base64
encoded strings).
Secrets are [currently] not encrypted by default. This is likely to change.
Can be injected as files in a Volume, or as Environment Variables.
ConfigMaps/Secrets (user-data)
Controller
Controllers are effectively a infinite loop that interacts with the
kubernetes API to ensure the actual state of a resource matches
the declared state.
#!/bin/bash
while true; do
count=$(kubectl get pods | grep nginx | wc -l)
if $count < 5; then
kubectl run --image=nginx nginx
fi
sleep 120
done
Operator
Introduction to Kubernetes
Kubernetes Manifest
apiVersion:
kind:
metadata:
spec:
Kubernetes Manifest
apiVersion: v1
kind: Service
metadata:
name: hello-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort:
8080
selector:
app: hello-
world
type: NodePort
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: hello-world
name: hello-app
spec:
replicas: 2
template:
metadata:
labels:
app: hello-world
spec:
containers:
- image: paulczar/hello-
world
name: hello-world
hello-app Pod
app=hello-world
hello-app Pod
app=hello-world
hello-svc Service
app=hello-world
http
80
http 8080 - load balanced
Kubernetes Manifest
https://url
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hello-goodbye
spec:
rules:
- http:
paths:
- path: /hello
backend:
serviceName: hello-svc
servicePort: 80
- http:
paths:
- path: /goodbye
backend:
serviceName: goodbye-svc
servicePort: 81
ingress-nginx
app=hello-world
hello-app Pod
app=hello-world
hello-svc Service
app=hello-world
http 8080
hello-app Pod
app=goodbye-world
goodbye-svc
Service
app=goodbye-world
http 8080
http://url/hello http://url/goodbye
$ kubectl apply -f manifests/
deployment "hello-app" created
service "hello-svc" created
deployment "goodbye-app" created
service "goodbye-svc" created
ingress "hello-goodbye" created
$ curl -k https://$(minikube ip)/hello
Hello World!
$ curl -k https://$(minikube ip)/goodbye
Goodbye Cruel world!
DEMO
Just Enough Modernization for Kubernetes (JEMFORK)
I. Codebase — One codebase tracked in revision control, many deploys
II. Dependencies — Explicitly declare and isolate dependencies
III. Config — Store config in the environment
IV. Backing Services — Treat backing services as attached resources
V. Build, release, run — Strictly separate build and run stages
VI. Processes — Execute the app as one or more stateless processes
Just Enough Modernization for Kubernetes (JEMFORK)
VII. Port binding — Export services via port binding
VIII. Concurrency — Scale out via the process model
IX. Disposability — Maximize robustness with fast startup and graceful shutdown
X. Dev/prod parity — Keep development, staging, and production as similar as possible
XI. Logs — Treat logs as event streams
XII. Admin processes — Run admin/management tasks as one-off processes
Just Enough Modernization for Kubernetes (JEMFORK)
III. Config — Store config in the environment
Just Enough Modernization for Kubernetes (JEMFORK)
Environment Variables
Just Enough Modernization for Kubernetes (JEMFORK)
Environment Variables
https://scoutapark.com
ingress-nginx
scout-nginx Pod
app=scout-nginx
scout-nginx
Service
app=scout-nginx
http 8080
wordpress Pod
app=wordpress
wordpress Service
app=wordpress
http 8080
http://scoutapark.com/ http://scoutapark.com/blog
scout-php Service
app=scout-php
tcp 9000
mysql Service
app=mysql
mysql Pod
app=mysql
tcp 3306
scout-php Pod
app=scout-php
<INSERT DEMO HERE>
1 of 32

Recommended

Kubernetes for the PHP developer by
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
362 views61 slides
Kubernetes day 2 Operations by
Kubernetes day 2 OperationsKubernetes day 2 Operations
Kubernetes day 2 OperationsPaul Czarkowski
1.7K views61 slides
Application Modernization with PKS / Kubernetes by
Application Modernization with PKS / KubernetesApplication Modernization with PKS / Kubernetes
Application Modernization with PKS / KubernetesPaul Czarkowski
228 views25 slides
A DevOps guide to Kubernetes by
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to KubernetesPaul Czarkowski
397 views65 slides
Docker Kubernetes Istio by
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes IstioAraf Karsh Hamid
3.7K views129 slides
Kubernetes and Istio by
Kubernetes and IstioKubernetes and Istio
Kubernetes and IstioKetan Gote
154 views29 slides

More Related Content

What's hot

KubeCon EU 2016: ITNW (If This Now What): Orchestrating an Enterprise by
KubeCon EU 2016: ITNW (If This Now What): Orchestrating an EnterpriseKubeCon EU 2016: ITNW (If This Now What): Orchestrating an Enterprise
KubeCon EU 2016: ITNW (If This Now What): Orchestrating an EnterpriseKubeAcademy
341 views47 slides
Kubernetes automation in production by
Kubernetes automation in productionKubernetes automation in production
Kubernetes automation in productionPaul Bakker
3.9K views82 slides
Kubernetes Ingress 101 by
Kubernetes Ingress 101Kubernetes Ingress 101
Kubernetes Ingress 101Kublr
99 views24 slides
Devops - Microservice and Kubernetes by
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and KubernetesNodeXperts
565 views68 slides
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes by
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB
172 views32 slides
Why kubernetes matters by
Why kubernetes mattersWhy kubernetes matters
Why kubernetes mattersPlatform9
3K views48 slides

What's hot(20)

KubeCon EU 2016: ITNW (If This Now What): Orchestrating an Enterprise by KubeAcademy
KubeCon EU 2016: ITNW (If This Now What): Orchestrating an EnterpriseKubeCon EU 2016: ITNW (If This Now What): Orchestrating an Enterprise
KubeCon EU 2016: ITNW (If This Now What): Orchestrating an Enterprise
KubeAcademy341 views
Kubernetes automation in production by Paul Bakker
Kubernetes automation in productionKubernetes automation in production
Kubernetes automation in production
Paul Bakker3.9K views
Kubernetes Ingress 101 by Kublr
Kubernetes Ingress 101Kubernetes Ingress 101
Kubernetes Ingress 101
Kublr99 views
Devops - Microservice and Kubernetes by NodeXperts
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and Kubernetes
NodeXperts565 views
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes by MongoDB
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB172 views
Why kubernetes matters by Platform9
Why kubernetes mattersWhy kubernetes matters
Why kubernetes matters
Platform93K views
K8s in 3h - Kubernetes Fundamentals Training by Piotr Perzyna
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
Piotr Perzyna397 views
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an... by Brian Grant
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
Brian Grant35.5K views
Helm - Package Manager for Kubernetes by Knoldus Inc.
Helm - Package Manager for KubernetesHelm - Package Manager for Kubernetes
Helm - Package Manager for Kubernetes
Knoldus Inc.342 views
Introduction to Kubernetes by rajdeep
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
rajdeep46.8K views
Container orchestration from theory to practice by Docker, Inc.
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
Docker, Inc.347 views
Enabling ceph-mgr to control Ceph services via Kubernetes by mountpoint.io
Enabling ceph-mgr to control Ceph services via KubernetesEnabling ceph-mgr to control Ceph services via Kubernetes
Enabling ceph-mgr to control Ceph services via Kubernetes
mountpoint.io394 views
OpenShift Enterprise 3.1 vs kubernetes by Samuel Terburg
OpenShift Enterprise 3.1 vs kubernetesOpenShift Enterprise 3.1 vs kubernetes
OpenShift Enterprise 3.1 vs kubernetes
Samuel Terburg42.1K views
Introduction to kubernetes by Gabriel Carro
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
Gabriel Carro236 views
Kubernetes Architecture - beyond a black box - Part 2 by Hao H. Zhang
Kubernetes Architecture - beyond a black box - Part 2Kubernetes Architecture - beyond a black box - Part 2
Kubernetes Architecture - beyond a black box - Part 2
Hao H. Zhang2.5K views
Kubernetes 101 VMworld 2019 workshop slides by Simone Morellato
Kubernetes 101 VMworld 2019 workshop slidesKubernetes 101 VMworld 2019 workshop slides
Kubernetes 101 VMworld 2019 workshop slides
Simone Morellato683 views
Social Connections 14 - Kubernetes Basics for Connections Admins by panagenda
Social Connections 14 - Kubernetes Basics for Connections AdminsSocial Connections 14 - Kubernetes Basics for Connections Admins
Social Connections 14 - Kubernetes Basics for Connections Admins
panagenda2.5K views
Orchestrating Microservices with Kubernetes by Weaveworks
Orchestrating Microservices with Kubernetes Orchestrating Microservices with Kubernetes
Orchestrating Microservices with Kubernetes
Weaveworks2.4K views

Similar to Introduction to Kubernetes

JDD2015: Kubernetes - Beyond the basics - Paul Bakker by
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerPROIDEA
77 views41 slides
Kubernetes workshop -_the_basics by
Kubernetes workshop -_the_basicsKubernetes workshop -_the_basics
Kubernetes workshop -_the_basicsSjuul Janssen
82 views35 slides
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen... by
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...Codemotion
136 views35 slides
DCEU 18: Docker Container Networking by
DCEU 18: Docker Container NetworkingDCEU 18: Docker Container Networking
DCEU 18: Docker Container NetworkingDocker, Inc.
821 views32 slides
Scaling docker with kubernetes by
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetesLiran Cohen
2.4K views79 slides
Kubernetes and docker by
Kubernetes and dockerKubernetes and docker
Kubernetes and dockerSmartLogic
958 views14 slides

Similar to Introduction to Kubernetes(20)

JDD2015: Kubernetes - Beyond the basics - Paul Bakker by PROIDEA
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
PROIDEA77 views
Kubernetes workshop -_the_basics by Sjuul Janssen
Kubernetes workshop -_the_basicsKubernetes workshop -_the_basics
Kubernetes workshop -_the_basics
Sjuul Janssen82 views
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen... by Codemotion
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...
Salvatore Incandela, Fabio Marinelli - Using Spinnaker to Create a Developmen...
Codemotion136 views
DCEU 18: Docker Container Networking by Docker, Inc.
DCEU 18: Docker Container NetworkingDCEU 18: Docker Container Networking
DCEU 18: Docker Container Networking
Docker, Inc.821 views
Scaling docker with kubernetes by Liran Cohen
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
Liran Cohen2.4K views
Kubernetes and docker by SmartLogic
Kubernetes and dockerKubernetes and docker
Kubernetes and docker
SmartLogic958 views
Kubernetes on AWS by Grant Ellis
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWS
Grant Ellis1.1K views
Kubernetes on AWS by Grant Ellis
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWS
Grant Ellis185 views
Ports, pods and proxies by LibbySchulze
Ports, pods and proxiesPorts, pods and proxies
Ports, pods and proxies
LibbySchulze119 views
Containers as a Service with Docker by Docker, Inc.
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
Docker, Inc.3.1K views
Docker Container As A Service - March 2016 by Patrick Chanezon
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
Patrick Chanezon3.5K views
Kubernetes: Container Orchestration for Production-grade People by ASPEX_BE
Kubernetes: Container Orchestration for Production-grade PeopleKubernetes: Container Orchestration for Production-grade People
Kubernetes: Container Orchestration for Production-grade People
ASPEX_BE51 views
Kubernetes Networking by CJ Cullen
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
CJ Cullen26.7K views
Deploying windows containers with kubernetes by Ben Hall
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
Ben Hall367 views
Kubernetes - Sailing a Sea of Containers by Kel Cecil
Kubernetes - Sailing a Sea of ContainersKubernetes - Sailing a Sea of Containers
Kubernetes - Sailing a Sea of Containers
Kel Cecil1.4K views
OSS Japan 2019 service mesh bridging Kubernetes and legacy by Steve Wong
OSS Japan 2019 service mesh bridging Kubernetes and legacyOSS Japan 2019 service mesh bridging Kubernetes and legacy
OSS Japan 2019 service mesh bridging Kubernetes and legacy
Steve Wong274 views
Developing Java based microservices ready for the world of containers by Claus Ibsen
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
Claus Ibsen1.2K views
DevOpSec_KubernetesOperatorUsingJava.pdf by kanedafromparis
DevOpSec_KubernetesOperatorUsingJava.pdfDevOpSec_KubernetesOperatorUsingJava.pdf
DevOpSec_KubernetesOperatorUsingJava.pdf
kanedafromparis12 views

Recently uploaded

KubeConNA23 Recap.pdf by
KubeConNA23 Recap.pdfKubeConNA23 Recap.pdf
KubeConNA23 Recap.pdfMichaelOLeary82
28 views27 slides
Cocktail of Environments. How to Mix Test and Development Environments and St... by
Cocktail of Environments. How to Mix Test and Development Environments and St...Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...Aleksandr Tarasov
26 views135 slides
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf by
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfMichaelOLeary82
13 views74 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
174 views14 slides
GDSC GLAU Info Session.pptx by
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptxgauriverrma4
15 views28 slides
Discover Aura Workshop (12.5.23).pdf by
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdfNeo4j
20 views55 slides

Recently uploaded(20)

Cocktail of Environments. How to Mix Test and Development Environments and St... by Aleksandr Tarasov
Cocktail of Environments. How to Mix Test and Development Environments and St...Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf by MichaelOLeary82
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
MichaelOLeary8213 views
GDSC GLAU Info Session.pptx by gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
Discover Aura Workshop (12.5.23).pdf by Neo4j
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdf
Neo4j20 views
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf by ThomasBronack
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdfBronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
ThomasBronack31 views
Deep Tech and the Amplified Organisation: Core Concepts by Holonomics
Deep Tech and the Amplified Organisation: Core ConceptsDeep Tech and the Amplified Organisation: Core Concepts
Deep Tech and the Amplified Organisation: Core Concepts
Holonomics17 views
LLMs in Production: Tooling, Process, and Team Structure by Aggregage
LLMs in Production: Tooling, Process, and Team StructureLLMs in Production: Tooling, Process, and Team Structure
LLMs in Production: Tooling, Process, and Team Structure
Aggregage65 views
Optimizing Communication to Optimize Human Behavior - LCBM by Yaman Kumar
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBM
Yaman Kumar39 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE85 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue209 views
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays38 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu474 views
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... by Moses Kemibaro
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Moses Kemibaro38 views
What is Authentication Active Directory_.pptx by HeenaMehta35
What is Authentication Active Directory_.pptxWhat is Authentication Active Directory_.pptx
What is Authentication Active Directory_.pptx
HeenaMehta3515 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li104 views
AI + Memoori = AIM by Memoori
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIM
Memoori15 views

Introduction to Kubernetes

  • 1. Logical Kubernetes Architecture API Server Kube Scheduler K8s Master Controller Manager Etcd Kubelet Kube-proxy K8s Worker Pod Pod Pod K8s Worker Pod Pod Pod K8s Worker Pod Pod Pod CNI CNI CNI Docker Kubelet Kube-proxy Docker Kubelet Kube-proxy Docker
  • 3. POD
  • 4. Container Container Pod Pod one or more application containers that are tightly coupled, sharing network and storage. Example: a web front-end Pod that consists of an NGINX container and a PHP-FPM container with a shared unix socket and a “init” container to transform their config files based on environment variables.
  • 5. Container Container Pod ReplicaSet Extends Pod resource to run and maintain a specific number of copies of a pod. Container Container Pod ReplicaSet
  • 6. Container Container Pod Deployment a controller that ensures a set number of replicas of a Pod is running and provides update and upgrade workflows for your Pods. Example: cloud native Node app that scales horizontally and upgrades 2 pods at a time. Container Container Pod ReplicaSet Deployment
  • 7. Container Container Pod statefulset a controller that manages stateful application Deployments by providing sticky identity for pods and strict ordering and uniqueness. Example: Cassandra database. First pod is ‘cassandra-0’ thus all other pods in the set can be told to cluster to ‘cassandra-0’ and it will form a ring, plus the storage will survive pod restarts. Container Container Pod ReplicaSet Deployment Statefulset
  • 9. Container Container Pod 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 EBS volume, iscsi, NFS, etc.
  • 11. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type ClusterIP (default) exposes service on a cluster- internal IP. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7
  • 12. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type NodePort extends ClusterIP to expose services on each node’s IP via a static port. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7 192.168.0.5:4530 K8s Worker K8s Worker 192.168.0.6:4530
  • 13. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type LoadBalancer extends NodePort to configure a cloud provider’s load balancer using the cloud-controller- manager. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7 192.168.0.5:4530 K8s Worker K8s Worker 192.168.0.6:4530 Load Balancer 33.6.5.22:80
  • 14. Ingress a controller that manages an external entity to provide load balancing, SSL termination and name-based virtual hosting to services based on a set of rules. Ingress Service app=bacon https://example.com Service app=eggs /bacon eggs
  • 15. Config Map / Secret
  • 16. Provides key-value pairs to be injected into a pod much like user-data is injected into a Virtual Machine in the cloud. Allows you to do last minute configuration of applications running on Kubernetes such as setting a database host, or a admin password. ConfigMaps store values as strings, Secrets store them as byte arrays (serialized as base64 encoded strings). Secrets are [currently] not encrypted by default. This is likely to change. Can be injected as files in a Volume, or as Environment Variables. ConfigMaps/Secrets (user-data)
  • 18. Controllers are effectively a infinite loop that interacts with the kubernetes API to ensure the actual state of a resource matches the declared state. #!/bin/bash while true; do count=$(kubectl get pods | grep nginx | wc -l) if $count < 5; then kubectl run --image=nginx nginx fi sleep 120 done
  • 22. Kubernetes Manifest apiVersion: v1 kind: Service metadata: name: hello-svc spec: ports: - port: 80 protocol: TCP targetPort: 8080 selector: app: hello- world type: NodePort apiVersion: apps/v1beta1 kind: Deployment metadata: labels: app: hello-world name: hello-app spec: replicas: 2 template: metadata: labels: app: hello-world spec: containers: - image: paulczar/hello- world name: hello-world hello-app Pod app=hello-world hello-app Pod app=hello-world hello-svc Service app=hello-world http 80 http 8080 - load balanced
  • 23. Kubernetes Manifest https://url apiVersion: extensions/v1beta1 kind: Ingress metadata: name: hello-goodbye spec: rules: - http: paths: - path: /hello backend: serviceName: hello-svc servicePort: 80 - http: paths: - path: /goodbye backend: serviceName: goodbye-svc servicePort: 81 ingress-nginx app=hello-world hello-app Pod app=hello-world hello-svc Service app=hello-world http 8080 hello-app Pod app=goodbye-world goodbye-svc Service app=goodbye-world http 8080 http://url/hello http://url/goodbye
  • 24. $ kubectl apply -f manifests/ deployment "hello-app" created service "hello-svc" created deployment "goodbye-app" created service "goodbye-svc" created ingress "hello-goodbye" created $ curl -k https://$(minikube ip)/hello Hello World! $ curl -k https://$(minikube ip)/goodbye Goodbye Cruel world!
  • 25. DEMO
  • 26. Just Enough Modernization for Kubernetes (JEMFORK) I. Codebase — One codebase tracked in revision control, many deploys II. Dependencies — Explicitly declare and isolate dependencies III. Config — Store config in the environment IV. Backing Services — Treat backing services as attached resources V. Build, release, run — Strictly separate build and run stages VI. Processes — Execute the app as one or more stateless processes
  • 27. Just Enough Modernization for Kubernetes (JEMFORK) VII. Port binding — Export services via port binding VIII. Concurrency — Scale out via the process model IX. Disposability — Maximize robustness with fast startup and graceful shutdown X. Dev/prod parity — Keep development, staging, and production as similar as possible XI. Logs — Treat logs as event streams XII. Admin processes — Run admin/management tasks as one-off processes
  • 28. Just Enough Modernization for Kubernetes (JEMFORK) III. Config — Store config in the environment
  • 29. Just Enough Modernization for Kubernetes (JEMFORK) Environment Variables
  • 30. Just Enough Modernization for Kubernetes (JEMFORK) Environment Variables
  • 31. https://scoutapark.com ingress-nginx scout-nginx Pod app=scout-nginx scout-nginx Service app=scout-nginx http 8080 wordpress Pod app=wordpress wordpress Service app=wordpress http 8080 http://scoutapark.com/ http://scoutapark.com/blog scout-php Service app=scout-php tcp 9000 mysql Service app=mysql mysql Pod app=mysql tcp 3306 scout-php Pod app=scout-php