$30 off During Our Annual Pro Sale. View Details »

SingaDev - Kubernetes. From 0 to Production wit...

Kevin Dubois
December 14, 2023
66

SingaDev - Kubernetes. From 0 to Production with Java

Kevin Dubois

December 14, 2023
Tweet

More Decks by Kevin Dubois

Transcript

  1. @kevindubois Kubernetes. From 0 to Production-grade with Java Kevin Dubois

    Principal Developer Advocate, Red Hat @kevindubois
  2. @kevindubois Kevin Dubois 🤘 Principal Developer Advocate at Red Hat

    🤘 International Speaker 🤘 18+ years professional software development experience 🤘 Speak English, Dutch, French, Italian 🤘 Open Source Contributor (Quarkus, Camel, Knative, ..) 🤘 Open Source Community Member (Belgian JUG, Belgian CNCF chapter) 🤘 and … a Quarkus Fan(boy) :) @[email protected] youtube.com/@thekevindubois github.com/kdubois
  3. @kevindubois “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
  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 Build Time Runtime Packaging (maven, etc) Load config file

    from file system Parse it Classpath scanning to find annotated classes Attempt to load class to enable/disable features Build its model of the world. Start the management (thread, pool…) @ @ </> How Does “Traditional Java” Start?
  6. @kevindubois Kubernetes 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 ) “Captain Sensible” 󰤇
  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 @kevindubois @alexsotob
  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.