Share
Embed
Kubernetes, Azure & Dotnet - What's it all about?
Introduction to Kubernetes
Covers origin and capabilities of Kubernetes and should be a good introduction to the basics for anyone even non .NET devs.
Video of shorter version of talk: http://bit.ly/k8s-ndc
Shahid Iqbal
March 29, 2019
Transcript
55 slides
-
Shahid Iqbal | Freelance consultant @shahiddev Kubernetes, Azure & .NET
What’s it all about? -
@shahiddev Very brief intro Freelance hands-on consultant working on .NET,
Azure & Kubernetes Developer/Architect in .NET for +10yrs based in the UK Microsoft MVP Co-organiser of the MK.net meetup in the UK @shahiddev on Twitter https://www.linkedin.com/in/shahiddev/ https://sessionize.com/shahid-iqbal https://blog.headforcloud.com -
@shahiddev Agenda Kubernetes overview Creating clusters and deploying apps Demos
Managed Kubernetes providers Demos Hybrid clusters Planning for Kubernetes -
@shahiddev Key takeaways A good understanding of the Kubernetes architecture
and key concepts Confidence to create clusters and deploy applications Launching pad to go away and learn more Caveat: Not a Docker tutorial – won’t go into details of creating containers -
@shahiddev Where to run Kubernetes? On premise Cloud IaaS AKS
GKE Managed providers -
@shahiddev Kubernetes features Container orchestration Horizontal scaling Rolling deployments and
rollbacks Self healing Service discovery and load balancing Batch execution (jobs) … -
@shahiddev Kubernetes components Networking – CNI/CNM ReplicaSets Ingress (L7 LB)
Monitoring Readiness/health-checking Config maps Storage (PV/PVC) Daemonsets Statefulsets Namespaces RBAC Helm Pod Autoscaling Secrets -
@shahiddev Control plane Node(s) Worker Node Worker Node Worker Node
API High-level architecture Management/Control plane UI/CLI Windows nodes GA! (K8s 1.14) -
@shahiddev Anatomy of a control plane node etcd API Server
Scheduler Controller manager Cloud Controller manager Kubectl UI -
@shahiddev Anatomy of a worker node Kubelet Kube-proxy supervisord fluentd
Pod Pod Pod Pod Container runtime -
@shahiddev Pods Localhost Node Pod Pod • Containers within a
pod that share resources • Can communicate over localhost • Are deployed/scaled as a unit -
@shahiddev Kubernetes Manifest files YAML or JSON files Defines application
structure/resources Desired state Containers = application Manifest = “infrastructure/configuration as code” Should be in source control -
@shahiddev Kubernetes Configuration files “kubectl run - -image=<img> - -port=<port>
- -dry-run –o yaml > myfile.yaml” http://bit.ly/k8s-yaml -
@shahiddev Accessing applications Node 1 Node 2 Node 3 Service
(172.176.24.76) app:hw 10.0.1.5 app:hw 10.0.1.8 app:hw 10.0.1.12 app:app2 10.0.1.6 Client cluster app:app2 10.0.1.7 -
@shahiddev Accessing applications Node 1 Node 2 Service (172.176.24.76) app:hw
10.0.1.5 app:hw 10.0.1.8 app:hw 10.0.1.14 app:app2 10.0.1.6 Client cluster app:app2 10.0.1.7 -
@shahiddev Accessing applications Node 1 Node 2 Node 3 Service
(172.176.24.76) (where label=app:hw) app:hw 10.0.1.5 app:hw 10.0.1.8 app:hw 10.0.1.12 app:app2 10.0.1.6 app:app2 10.0.1.7 -
@shahiddev Service types LoadBalancer Expose service publicly (relies on hosting
infrastructure) ClusterIP Assign it an internal cluster IP only – not public NodePort Port on each node which can route to service ExternalName Maps to a CNAME record (i.e. external service) -
@shahiddev Ingress Allows for routing using a single entry point
into the cluster Routing to different applications based on rules Single SSL termination point (depending on SSL cert type) May be preferable vs multiple LoadBalancer services Implemented by variety of providers – ngnix, haproxy etc More advanced control -> Service Mesh -
@shahiddev Host name based routing using Ingress Node 1 Node
2 Node 3 app1 svc app:app1 app:app1 app:app2 cluster app:app2 Load Balancer app2 svc Ingress controller Public IP app1.mydomain.com Host: app1.mydomain.com -
@shahiddev Host name based routing using Ingress Node 1 Node
2 Node 3 app1 svc app:app1 app:app1 app:app2 cluster app:app2 Load Balancer app2 svc Ingress controller Public IP app2.mydomain.com Host: app2.mydomain.com -
@shahiddev Helm De facto application package manager for Kubernetes “Apt-get/chocolatey
of Kubernetes” Parameterise settings and re-use settings Packages == Charts Kubeapps Hub – repository of public charts for common apps/services Package your applications as Helm charts -
@shahiddev Rolling updates Zero downtime rolling updates Blue/Green updates Rollback
*Rolling updates with complex data/schema changes still challenging. -
@shahiddev Speed of rollout vs service capacity Max unavailable number
of old pods taken offline during update Max surge number of new pods created alongside existing pods during update *(number or %) -
@shahiddev Rolling updates v1 v1 v1 v2 Max unavailable: 0
Max surge: 1 v2 v2 Service -
@shahiddev Blue/Green deployment v1 v1 v1 v2 Max unavailable: 0
Max surge: 100% v2 v2 Service -
@shahiddev Managed Kubernetes Providers Azure Kubernetes Service • Control plane
is handled by provider • Removes significant overhead of running K8s cluster • Free control plane node(s) – except EKS Google Kubernetes Engine -
@shahiddev Azure Kubernetes Service - AKS Management nodes not visible
(and not charged) Lose flexibility to run feature flags/startup params Supports multiple K8s versions with option to upgrade clusters Integration into existing Vnets RBAC using Azure AD* Cluster autoscaling* Nodes are auto-patched (but not restarted) Windows node pools (private preview) *preview features -
@shahiddev Azure Kubernetes Service - AKS //create resource group az
group create -n hfck8sRG -l westeurope //create cluster az aks create -n hfck8s -g hfck8sRG / -k 1.12.6 //k8s version / -c 3 //node count -
@shahiddev Microsoft support for Kubernetes Contribute to K8s project Acquisition
of Deis Brendan Burns - K8s co-founder works there More tooling for .NET developers coming Helm, Draft, Brigade, Azure Dev Spaces -
@shahiddev Single platform for all .NET apps Hybrid clusters (linux
+ windows worker nodes) “Legacy” full .NET framework apps & .NET core apps on single platform Single CI/CD approach Simplify evolving architecture to microservices by removing complexity around “plumbing” -
@shahiddev Unified platform for evolving architecture Node 1 Node 2
Node 3 myapp svc app:myapp app:myapp app:orders cluster Load Balancer orders svc Ingress controller Public IP myapp.com path: myapp.com Node 4 app:orders -
@shahiddev Unified platform for evolving architecture Node 1 Node 2
Node 3 myapp svc app:myapp app:myapp app:orders cluster Load Balancer orders svc Ingress controller Public IP myapp.com/orders path: myapp.com/orders Node 4 app:orders -
@shahiddev Hybrid clusters Windows nodes in private preview on AKS
Expect public preview soon AKS-Engine on Azure can create hybrid clusters (not managed) -
@shahiddev Planning for Kubernetes Don’t get sucked into the K8s
hype Focus on basics Develop 12-factor style apps (logging/readiness/health-checks) Clear plan for architecture/microservices Writing/migrating to .NET core CI/CD pipelines Containerise “legacy” .NET applications into Windows Containers Don’t forget container and cluster security Consider GitOps – beware of “pet” clusters -
@shahiddev Summary Kubernetes is mature and feature rich container orchestration
platform Many large organisations are betting on it as their platform of the future Windows support is gaining traction Microsoft is heavily invested in it Tooling/support for .NET developers will make the adoption even easier -
@shahiddev Where can I go to learn more? http://www.katacoda.com https://kubernetes.io/docs/home
Kubernetes up & running By Kelsey Hightower, Brendan Burns, Jo Beda -
Shahid Iqbal | Freelance consultant @shahiddev Thank You! Slides: http://bit.ly/k8s-azure-dotnet
@shahiddev on Twitter https://www.linkedin.com/in/shahiddev/ https://blog.headforcloud.com