Slide 1

Slide 1 text

Kubernetes for .NET Developers Hossam Barakat Senior Consultant at Readify @hossambarakat_ | www.hossambarakat.net

Slide 2

Slide 2 text

@hossambarakat_ • What is Kubernetes? • Why Kubernetes? • Kubernetes Architecture • Kubernetes Building Blocks Agenda

Slide 3

Slide 3 text

@hossambarakat_ Containers Hardware Host Operating System Application Application Application Container Dependencies Application Host Operating System Hardware Container Engine Container Container Container Container Hardware Host Operating System Virtual Machine Guest OS Application Virtual Machine Guest OS Application Hypervisor

Slide 4

Slide 4 text

@hossambarakat_ What is Docker?

Slide 5

Slide 5 text

@hossambarakat_ The application is deployed to production

Slide 6

Slide 6 text

@hossambarakat_ Then the application went viral

Slide 7

Slide 7 text

@hossambarakat_ Containers bring scalability challenges!

Slide 8

Slide 8 text

@hossambarakat_ Container orchestration platforms to rescue

Slide 9

Slide 9 text

@hossambarakat_ • Service discovery • Scaling • Health monitoring • Failover • Networking • Scheduling • Coordinated app upgrades Container Orchestration

Slide 10

Slide 10 text

@hossambarakat_ Kubernetes

Slide 11

Slide 11 text

@hossambarakat_ • Self-healing • Horizontal scaling • Service discovery and load balancing • Automated rollouts and rollbacks • Secret and configuration management • Storage orchestration • Automatic binpacking • Batch execution Why Kubernetes?

Slide 12

Slide 12 text

@hossambarakat_ Kubernetes Architecture Master Worker Worker Client Worker Cluster

Slide 13

Slide 13 text

@hossambarakat_ Kubernetes Architecture Master API Server Controller Manager Scheduler Worker Kubelet Container Runtime UI (Dashboard) CLI (Kubectl) Other Client(s) Container Container Cluster

Slide 14

Slide 14 text

@hossambarakat_ • Localhost installation (Minikube, Docker For Desktop) • On-Premise Installation (VMs, Bare Metal) • Cloud (Google, Azure, AWS,…) Installing Kubernetes

Slide 15

Slide 15 text

@hossambarakat_ ASP.NET App On Kubernetes ASP.NET Application

Slide 16

Slide 16 text

@hossambarakat_ ASP.NET App On Kubernetes ASP.NET Application ASP.NET Application ASP.NET Application

Slide 17

Slide 17 text

@hossambarakat_ Pods

Slide 18

Slide 18 text

@hossambarakat_ Pods Pod

Slide 19

Slide 19 text

@hossambarakat_ Pods Scaling Pod Pod

Slide 20

Slide 20 text

@hossambarakat_

Slide 21

Slide 21 text

@hossambarakat_ But wait… what happens if the pod dies?

Slide 22

Slide 22 text

@hossambarakat_ ReplicaSets Pod ReplicaSet Pod

Slide 23

Slide 23 text

@hossambarakat_ ReplicaSets Master Worker 1 Worker 2 Pod 1 Pod 2 Worker 3 Pod 2

Slide 24

Slide 24 text

@hossambarakat_ Labels Pod

Slide 25

Slide 25 text

@hossambarakat_

Slide 26

Slide 26 text

@hossambarakat_ Deployment ReplicaSet Deployment Pod Pod

Slide 27

Slide 27 text

@hossambarakat_ Deployment Rollout Deployment ReplicaSet V2 Pod Pod ReplicaSet V1 Pod Pod

Slide 28

Slide 28 text

@hossambarakat_

Slide 29

Slide 29 text

@hossambarakat_ Connecting to Pods 10.0.0.1 DB Pod A 10.0.0.2 DB Pod B ASP.NET Pod

Slide 30

Slide 30 text

@hossambarakat_ Service 10.0.0.2 Pod B 10.0.0.3 Pod C IP: 10.0.0.30 DNS: myservice Service 10.0.0.1 Pod A

Slide 31

Slide 31 text

@hossambarakat_ Service 10.0.0.1 DB Pod A ASP.NET Pod IP: 10.0.0.30 DNS: myservice Service

Slide 32

Slide 32 text

@hossambarakat_ Service IP: 10.0.0.30 DNS: tasks-app-svc Service IP: 10.0.0.90 DNS: mssql-service Service 10.0.0.1 Pod 10.0.0.1 Pod 10.0.0.1 Pod

Slide 33

Slide 33 text

@hossambarakat_

Slide 34

Slide 34 text

@hossambarakat_ Persistent Volume

Slide 35

Slide 35 text

@hossambarakat_ Persistent Volume

Slide 36

Slide 36 text

@hossambarakat_ Persistent Volume

Slide 37

Slide 37 text

@hossambarakat_

Slide 38

Slide 38 text

@hossambarakat_ Kubernetes in the cloud

Slide 39

Slide 39 text

Azure AKS $ az aks create -g myResourceGroup -n myCluster --generate-ssh-keys $ az aks get-credentials -g myResourceGroup -n myCluster $ kubectl get nodes $ az aks scale -g myResourceGroup -n myCluster --node-count 6

Slide 40

Slide 40 text

@hossambarakat_ • Scale agent nodes based on pending pods and nodes utilization • Scans the cluster periodically to check for pending pods or empty nodes and increases the size if possible AKS Cluster Autoscaler

Slide 41

Slide 41 text

@hossambarakat_ • Kubernetes Architecture • Deploy application using different workloads • Kubernetes in the cloud Summary

Slide 42

Slide 42 text

@hossambarakat_ • https://www.hossambarakat.net • https://github.com/hossambarakat/TaskList • Introduction to Kubernetes (edX) • Learn Kubernetes using Interactive Hands-on Scenarios (Katacoda) • https://kubernetes.io/docs/ Resources

Slide 43

Slide 43 text

@hossambarakat_ Questions?

Slide 44

Slide 44 text

Thanks Hossam Barakat @hossambarakat_ www.hossambarakat.net