Slide 1

Slide 1 text

@kevindubois @alexsotob From 0 to Production with Kubernetes Native Java Kevin Dubois Principal Developer Advocate Red Hat Alex Soto Bueno Director of Developer Experience Red Hat

Slide 2

Slide 2 text

@kevindubois @alexsotob Alex Soto (@alexsotob) ● @alexsotob ● [email protected] ● Currently Red Hat’s Director of Developer Experience ● Featured speaker at technology events ● A Java Champion since 2017 ● Writer, University Professor, Radio collaborator

Slide 3

Slide 3 text

@kevindubois @alexsotob Kevin Dubois 🤘 Principal Developer Advocate at Red Hat 🤘 Java Champion 🤘 Based in Belgium 󰎐 🤘 Speak English, Dutch, French, Italian 🤘 Open Source Contributor (Quarkus, Camel, Knative, ..) 🤘 Open Source Community Member (Belgian JUG, Belgian CNCF chapter) @[email protected] youtube.com/@thekevindubois github.com/kdubois

Slide 4

Slide 4 text

@kevindubois @alexsotob “Kube Native” Java !?

Slide 5

Slide 5 text

@kevindubois @alexsotob “Traditional” ● Throughput at the expense of footprint ● Long running at expense of startup speed ● Rich, dynamic behaviour for mutable systems Kube Native ● Throughput solved by scaling ● Ephemeral, immutable systems ● Footprint and startup speed matter

Slide 6

Slide 6 text

@kevindubois @alexsotob JVM Scaling * Graph is based on actual lab results at Red Hat

Slide 7

Slide 7 text

@kevindubois @alexsotob When you can’t scale fast enough…

Slide 8

Slide 8 text

@kevindubois @alexsotob Quarkus + Native (via GraalVM) 12 MB Quarkus + JVM (via OpenJDK) 73 MB Traditional Cloud-Native Stack 136 MB Quarkus + Native (via GraalVM) 0.016 Seconds Quarkus + JVM (via OpenJDK) 0.943 Seconds Traditional Cloud-Native Stack 4.3 Seconds Supersonic. Subatomic. Java

Slide 9

Slide 9 text

@kevindubois @alexsotob Let’s start building our app!

Slide 10

Slide 10 text

@kevindubois @alexsotob

Slide 11

Slide 11 text

@kevindubois @alexsotob @kevindubois

Slide 12

Slide 12 text

@kevindubois @alexsotob Container Running Sends traffic App not ready Ready??

Slide 13

Slide 13 text

@kevindubois @alexsotob After 2.6s (Kafka, DB, Caching) App is ready to receive traffic Container Running Sends traffic App not ready Ready??

Slide 14

Slide 14 text

@kevindubois @alexsotob Downtime of 2.6s Ready??

Slide 15

Slide 15 text

@kevindubois @alexsotob https://microprofile.io/

Slide 16

Slide 16 text

@kevindubois @alexsotob readinessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 10 periodSeconds: 3 Ready!

Slide 17

Slide 17 text

@kevindubois @alexsotob containers: - name: nginx-container image: nginx:latest ports: - containerPort: 80 volumes: - name: secret-volume secret: secretName: your-secret-name Kubernetes Secrets

Slide 18

Slide 18 text

@kevindubois @alexsotob resources: requests: memory: "300Mi" cpu: "250m" # 1/4 core limits: memory: "400Mi" cpu: "1000m" # 1 core Resource Limits

Slide 19

Slide 19 text

@kevindubois @alexsotob CPU Request More CPU Limit State your intentions

Slide 20

Slide 20 text

@kevindubois @alexsotob Memory Request More Memory Limit Burstable

Slide 21

Slide 21 text

@kevindubois @alexsotob Memory Request Limit Guaranteed

Slide 22

Slide 22 text

@kevindubois @alexsotob https://learn.microsoft.com/en-us/azure/developer/java/containers/overview vCPU cores Memory Heap Size GC Replicas 2 4Gb 75% Parallel 2 Some sensible starting numbers

Slide 23

Slide 23 text

@kevindubois @alexsotob https://learn.microsoft.com/en-us/azure/developer/java/containers/overview resources: requests: memory: "4000Mi" cpu: "2000m" limits: memory: "4000Mi" cpu: "2000m" - env: - name: JDK_JAVA_OPTIONS value: "-XX:+UseParallelGC -XX:MaxRAMPercentage=75" Sensible Initial Values ( JVM )

Slide 24

Slide 24 text

@kevindubois @alexsotob spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: "app" operator: In values: - my-app topologyKey: "kubernetes.io/hostname" containers: Pod Affinity = lower latency

Slide 25

Slide 25 text

@kevindubois @alexsotob @kevindubois @alexsotob Observability

Slide 26

Slide 26 text

@kevindubois @alexsotob Ready for Production!

Slide 27

Slide 27 text

@kevindubois @alexsotob Push to give energy windmill Kafka Topic 2.Sends the interaction Dashboard: Green Energy Nickname Team Push/Tap to generate energy Cars that need energy Two teams competing (top 5 players) First team wins @kevindubois @alexsotob

Slide 28

Slide 28 text

@kevindubois @alexsotob Architecture 3: Generate power (REST) Game Dashboard 1: Assign player Name & Team (REST) 6: Update dashboard (SSE) 2: Increment player cluster counter 4: Send power event 5: Receive power events

Slide 29

Slide 29 text

@kevindubois @alexsotob YOU PLAY! Scan the QR Code with your phone to play

Slide 30

Slide 30 text

@kevindubois @alexsotob

Slide 31

Slide 31 text

@kevindubois @alexsotob

Slide 32

Slide 32 text

@kevindubois @alexsotob

Slide 33

Slide 33 text

@kevindubois @alexsotob

Slide 34

Slide 34 text

@kevindubois @alexsotob

Slide 35

Slide 35 text

@kevindubois @alexsotob

Slide 36

Slide 36 text

@kevindubois @alexsotob

Slide 37

Slide 37 text

@kevindubois @alexsotob @kevindubois @alexsotob What is GitOps?

Slide 38

Slide 38 text

@kevindubois @alexsotob Treat everything as code Git Commands Infrastructure as Code Operations through Git workflows Git Repository Git is the single source of truth @kevindubois @alexsotob What is GitOps?

Slide 39

Slide 39 text

@kevindubois @alexsotob Pull Request Source Git Repository Image Registry Config Git Repository Kubernetes Deploy Monitor Detect drift CD Take action GitOps Application Delivery Model

Slide 40

Slide 40 text

@kevindubois @alexsotob Shaking Time :)

Slide 41

Slide 41 text

@kevindubois @alexsotob V2 Scan the QR Code with your phone to play

Slide 42

Slide 42 text

@kevindubois @alexsotob github.com/kdubois/quarkus-kubernetes-kafka-db github.com/redhat-developer-demos/quinoa-wind-turbine

Slide 43

Slide 43 text

@kevindubois @alexsotob Free Developer e-Books & Tutorials! developers.redhat.com/eventtutorials

Slide 44

Slide 44 text

@kevindubois @alexsotob Start exploring in the OpenShift Sandbox. Learn containers, Kubernetes, and OpenShift in your browser. developers.redhat.com/developer-sandbox Try Red Hat's products and technologies without setup or configuration.

Slide 45

Slide 45 text

@kevindubois @alexsotob @alexsotobu lordofthejars @alexsotob @thekevindubois kdubois @kevindubois