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

From 0 to Production with Kubernetes Native Jav...

From 0 to Production with Kubernetes Native Java @RivieraDev

Kevin Dubois

July 10, 2024
Tweet

More Decks by Kevin Dubois

Other Decks in Technology

Transcript

  1. @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
  2. @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
  3. @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
  4. @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
  5. @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
  6. @kevindubois @alexsotob After 2.6s (Kafka, DB, Caching) App is ready

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

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

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

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

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