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

Kubernetes. From 0 to Production-Grade with Java

Kubernetes. From 0 to Production-Grade with Java

I hear you thinking, “is this yet another session about doing cloud native development?”. Well.. yes, sort of, but we promise it’s going to be a good one - or so we think :).

In this session we’re going to talk (and demo!) about what it means to be a good Cloud Citizen - which is more than merely putting an application in a container and deploying it. To optimize your (Java) application's performance and resilience in the cloud, it is essential to consider factors such as providing real-time health status through fine-grained metrics. You’ll also need to ensure fast startup, and avoid excessive resource consumption within the cluster.
Being a good Cloud Citizen also involves streamlining configuration, deployment and upgrade processes. By integrating these tasks seamlessly, the application can facilitate smooth deployments and upgrades, which will lead to more efficiency and ease of management.

Join us in this session and embark on a journey to develop a perfect(ish) Cloud Native Java Application with Quarkus. This journey will encompass a comprehensive understanding of both the development and operational perspectives, aiming to optimize applications for the cloud environment. You will get an overview of the Kubernetes basics from a Java developer’s perspective and learn step-by-step how to get your application production ready on Kubernetes.

Kevin Dubois

October 05, 2023
Tweet

More Decks by Kevin Dubois

Other Decks in Programming

Transcript

  1. Alex Soto (@alexsotob) Who am I ? 2 • @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
  2. 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) @[email protected] youtube.com/@thekevindubois github.com/kdubois
  3. “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 @kevindubois @alexsotob
  4. 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 @kevindubois @alexsotob
  5. Kubernetes 12 containers: - name: nginx-container image: nginx:latest ports: -

    containerPort: 80 volumes: - name: secret-volume secret: secretName: your-secret-name @kevindubois @alexsotob
  6. Kubernetes 14 After 2.6s (Kafka, Infinispan) App is ready to

    receive traffic Container Running Sends traffic App not ready @kevindubois
  7. Kubernetes 17 resources: requests: memory: "300Mi" cpu: "250m" # 1/4

    core limits: memory: "400Mi" cpu: "1000m" # 1 core @kevindubois @alexsotob
  8. Kubernetes 22 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"
  9. Kubernetes 24 spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: -

    key: "app" operator: In values: - my-app topologyKey: "kubernetes.io/hostname" containers: @kevindubois @alexsotob
  10. The application 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
  11. 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
  12. YOU PLAY! Scan the QR Code with your phone to

    play @kevindubois @alexsotob
  13. What is GitOps? Treat everything as code Git Commands Infrastructure

    as Code Operations through Git workflows Git Repository Git is the single source of truth @kevindubois @alexsotob
  14. 37 Why GitOps? Push Pull Pull Request Source Git Repository

    Image Registry Config Git Repository Kubernetes Deploy Monitor Detect drift CD Take action @kevindubois @alexsotob
  15. 39 V2 Scan the QR Code with your phone to

    play @kevindubois @alexsotob