Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps...
Transcript of Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps...
![Page 1: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/1.jpg)
Introduction to Kubernetes (k8)
Tomislav Mikulin DevOps
![Page 2: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/2.jpg)
Word of caution
![Page 3: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/3.jpg)
What is kubernetes?
Formal definition:
“Kubernetes is an open source system for automating deployment, scaling and management of containerized applications”
Kubernetes documentation
![Page 4: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/4.jpg)
What is kubernetes?
Unformal definition:
“Kubernetes is like having a little devops in a cluster that takes care of you’re applications and makes sure that everything is up and running.”
Kelsey Hightower (Google)
![Page 5: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/5.jpg)
Packaging applications
Containers (Docker)
Two main benefits:
• They make shipping and deploying apps a lot easier!
• They bundle all the apps dependencies in a single image
![Page 6: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/6.jpg)
Packaging applications
Docker - like mobile apps on a smartphone, but for servers
![Page 7: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/7.jpg)
Docker deployment
![Page 8: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/8.jpg)
Now what?
![Page 9: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/9.jpg)
Why do we need k8?
• Real issues are:
• Application configuration
• Service discovery
• Managing updates
• Monitoring
• Deployment…
![Page 10: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/10.jpg)
Why is k8 special?
• Github (37,578 )
• 1693 contributors
Backed up by :
• Google, RedHat, CoreOS, Cloud Native Computing Foundation
• Cloud providers AWS, GCLOUD, AZURE
• 10/15 years of R&D in Google (Borg, Omega)
![Page 11: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/11.jpg)
k8 features
• Horizontal scaling
• Automated rollouts and rollbacks
• Self healing
• Service discovery and load balancing
• Secret and configuration management
• Better server utilization (less money goes to aws)
![Page 12: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/12.jpg)
Abstracts the hardware layer
LoadBalancers | Routes | DNS
Kubernetes Application
Storage Machine Network
EBS NFS GFS VM PHYSICAL L2 L3
Infrastructure
![Page 13: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/13.jpg)
k8 architecture
Kubernetes Master
KUBE - API SERVER
ETCDScheduler
Controller Manager
Kube-proxy
Kubelet
POD
Container
Kube-proxy
Kubelet
POD
Container
Node Node
Cloud
Cloud Controller
![Page 14: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/14.jpg)
p. pods/apps running on k8
Docker
Kubelet
POD
Container
Docker
Kubelet
POD
Container
Node Node
YAML APP
SPECAPI
Master
Registry
![Page 15: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/15.jpg)
k8 basic objects
• Everything in k8 is a declarative configuration object (RESTfull API object)
k8 uses them to represent the state of a cluster:
• Pod - a group of one or more containers
• Service - gives your pods a stable IP
• Volume - storage and configuration for the pods
• Nodes - VM or physical machine
![Page 16: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/16.jpg)
k8 high-level objects controllers
• ReplicaSet
• Deployment (important)
• StatefulState (PetSets)
• DaemonSet
• Job
![Page 17: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/17.jpg)
Whats a pod anyway?
Pod is group of containers
Containers run under the same Network and UTS namespace (same hostname and net. interface)
Run under the same IPC namespace
Containers in a pod share the same IP address (localhost) and port space
Pods can be seen as very very light VM-s
![Page 18: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/18.jpg)
Basic objects for an app
• Deployment object
generate the pods with a label, and keeps them alive
• Service object
Grouping object that gives you a stable IP (virtual IP) for the pods that have a certain LABEL
• (Config map - app configuration file)
![Page 19: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/19.jpg)
Services in k8
POD1 IP: 2.1.1.1
POD2 IP: 2.1.1.2
POD3 IP: 2.1.1.3
Frontend Service IP: 1.1.1.1
Backend Service IP: 1.1.1.2
FRONTED
BACKEND
POD IP: 2.1.1.4
![Page 20: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/20.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 1
NODE 1
NODE 1
NODE 2 NODE 3
![Page 21: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/21.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 1
POD
Container
NODE 1
NODE 1
NODE 2 NODE 3
![Page 22: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/22.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 3
POD
Container
NODE 1
NODE 1
NODE 2 NODE 3
![Page 23: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/23.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 3
POD
Container
NODE 1
NODE 1
NODE 2 NODE 3
POD
Container
POD
Container
![Page 24: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/24.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 3
POD
Container
NODE 1
NODE 1
NODE 2 NODE 3
POD
Container
![Page 25: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/25.jpg)
Deployment controller
Drives current state towards the desired state
app: televendcloud replicas: 3
POD
Container
NODE 1
NODE 1
NODE 2 NODE 3
POD
Container
POD
Container
![Page 26: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/26.jpg)
k8 documentation
![Page 27: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open](https://reader031.fdocuments.in/reader031/viewer/2022040121/5ec96a400176134d8e1bf56c/html5/thumbnails/27.jpg)
k8 learning material:
Minikube - program (for practicing and development)
“Up and running with Kubernetes” - book
Scalable microservices with Kubernetes - Udacity course
https://www.katacoda.com/ - website
kubernetes.io - documentation