Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JavaCro - From 0 to Production with Kubernetes ...

JavaCro - From 0 to Production with Kubernetes Native Java

Kevin Dubois

October 13, 2024
Tweet

More Decks by Kevin Dubois

Other Decks in Programming

Transcript

  1. @kevindubois From 0 to Production with Kubernetes Native Java Kevin

    Dubois (@kevindubois) Senior Principal Developer Advocate Red Hat
  2. @kevindubois Kevin Dubois 🤘 Sr 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
  3. @kevindubois “Traditional” Java • Throughput at the expense of footprint

    • Long running at expense of startup speed • Rich, dynamic behaviour for mutable systems “Kube Native” Java • Throughput solved by scaling • Ephemeral, immutable systems • Footprint and startup speed matter
  4. @kevindubois 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
  5. @kevindubois 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
  6. @kevindubois After 2.6s (Kafka, DB, Caching) App is ready to

    receive traffic Container Running Sends traffic App not ready Ready??
  7. @kevindubois containers: - name: nginx-container image: nginx:latest ports: - containerPort:

    80 volumes: - name: secret-volume secret: secretName: your-secret-name Kubernetes Secrets
  8. @kevindubois resources: requests: memory: "300Mi" cpu: "250m" # 1/4 core

    limits: memory: "400Mi" cpu: "1000m" # 1 core Resource Limits
  9. @kevindubois 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 )
  10. @kevindubois spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key:

    "app" operator: In values: - my-app topologyKey: "kubernetes.io/hostname" containers: Pod Affinity = lower latency
  11. @kevindubois 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
  12. @kevindubois 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
  13. @kevindubois 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?
  14. @kevindubois Pull Request Source Git Repository Image Registry Config Git

    Repository Kubernetes Deploy Monitor Detect drift CD Take action GitOps Application Delivery Model
  15. @kevindubois 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.