Slide 1

Slide 1 text

Azure Kubernetes Service Quickstart Joost van Uitert Software Engineer DEVCAMPNOORD 04-04-2024

Slide 2

Slide 2 text

Structure

Slide 3

Slide 3 text

About me

Slide 4

Slide 4 text

What is Kubernetes? • Open-source platform for managing containerized workloads and services. • Widely used, so a lot of support and can be used on many platforms, including Azure

Slide 5

Slide 5 text

What is Kubernetes? • Kubernetes means something like helmsman or captain in Greek. Some Kubernetes components continue the nautical theme.

Slide 6

Slide 6 text

Alternatives Azure Container Instances + Easier / simpler + No overhead containers + Serverless + Linux and Windows - Limited scale - Limited customizability - Limited integrations Azure Container Apps + Easier / simpler + No overhead containers + Serverless + Price flexibility - Only Linux OS - Limited scale - Limited customizability - Limited integrations

Slide 7

Slide 7 text

When should we use AKS? • Scale is big enough • Enough Traffic/Use • Expertise of the team • Needs to be highly available

Slide 8

Slide 8 text

How does Kubernetes work?

Slide 9

Slide 9 text

Cluster

Slide 10

Slide 10 text

Node

Slide 11

Slide 11 text

resource aks 'Microsoft.ContainerService/managedClusters@2022-05-02-preview' = { properties: { dnsPrefix: dnsPrefix agentPoolProfiles: [ { name: 'agentpool' osDiskSizeGB: osDiskSizeGB count: 3 vmSize: 'Standard_B4ms' osType: 'Linux' mode: 'System' enableNodePublicIP: false } { name: 'apps' count: 2 vmSize: 'Standard_A2_v2’ … type: 'VirtualMachineScaleSets' maxCount: 2 minCount: 0 enableAutoScaling: true mode: 'User' osType: 'Linux' } ] } sku: { name: 'Basic' tier: 'Free' } }

Slide 12

Slide 12 text

Namespace

Slide 13

Slide 13 text

Namespace apiVersion: v1 kind: Namespace metadata: name: aksdemoapp ---

Slide 14

Slide 14 text

Pod • Smallest deployable unit • (Group of) container(s)

Slide 15

Slide 15 text

Container • “Ready to run software package”

Slide 16

Slide 16 text

Container FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env WORKDIR /App # Copy everything COPY . ./ # Restore as distinct layers RUN dotnet restore # Build and publish a release RUN dotnet publish -c Release -o out # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /App COPY --from=build-env /App/out . ENTRYPOINT ["dotnet", "DotNet.Docker.dll"]

Slide 17

Slide 17 text

Cluster + nodes + namespaces + pods + containers FE BE FE FE BE

Slide 18

Slide 18 text

What are the benefits? • Ability to scale • Automatic recovery (restart) • Geen deployment downtime

Slide 19

Slide 19 text

How do we operate all of this?

Slide 20

Slide 20 text

Kubectl en k9s

Slide 21

Slide 21 text

Demo: cluster bicep deployment

Slide 22

Slide 22 text

Demo: let’s deploy an app!

Slide 23

Slide 23 text

Demo: let’s deploy an api!

Slide 24

Slide 24 text

What have we learned? • Creating Application Images • Pushing Images to Repository • Deployment yml

Slide 25

Slide 25 text

What do we have now?

Slide 26

Slide 26 text

Is it that easy? No • Roles / Role bindings • Service accounts • Configmaps • Secrets • Persistent volume (claims) • Ingresses • Services • Resource limits • Cluster roles / Cluster role bindings • Daemonsets • Cronjobs / Jobs • Init containers • Annotations • Labels • Ingress controllers • GatewayAPI’s • DNS • Ephemeral volumes • Taints and tolerations • Certificate management • Proxies • Addons • Custom resource definitions • Garbage collection

Slide 27

Slide 27 text

Demo: let’s scale an api!

Slide 28

Slide 28 text

What have we learned? • Scaling in Kubernetes is easy!

Slide 29

Slide 29 text

Demo: let’s break an api!

Slide 30

Slide 30 text

What have we learned? • Liveness en readiness probe • Rollout van applicatie is slim var builder = WebApplication.CreateBuilder(args); builder.Services.AddHealthChecks(); var app = builder.Build(); app.MapHealthChecks("/healthz"); app.Run();

Slide 31

Slide 31 text

How does (managed) Azure Kubernetes Service work? • Works with • Identities / AD • Cost management • Migratie services • Networking • Can of course connect to • Storage • Key Vault • Application Gateway • Azure Container Registry • Kubernetes takes care of the containers • You are responsible for the nodes / vm's

Slide 32

Slide 32 text

Further reading • Prometheus • Grafana • Helm • Calico • Istio

Slide 33

Slide 33 text

Further reading • Prometheus • Grafana • Helm • Calico • Istio

Slide 34

Slide 34 text

Further reading • Prometheus • Grafana • Helm • Calico • Istio

Slide 35

Slide 35 text

Further reading • Prometheus • Grafana • Helm • Calico • Istio

Slide 36

Slide 36 text

Questions?