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

Cloud Native with Spring Boot and Kubernetes

C20b9829daddbee16e359b0a750660a5?s=47 Thomas Vitale
February 10, 2021

Cloud Native with Spring Boot and Kubernetes

Principles and patterns for building cloud native application using Spring Boot, containerizing them with Cloud Native Buildpacks, and deploying them on a Kubernetes cluster through a GitOps workflow.


Thomas Vitale

February 10, 2021


  1. Thomas Vitale @vitalethomas thomasvitale.com Cloud Native With Spring Boot and

    Kubernetes Systematic - 10/02/2021 systematic.com
  2. Thomas Vitale • Senior Software Engineer at Systematic, Denmark. •

    Spring, Cloud Native, DevOps, Application Security. • Author of “Cloud Native Spring in Action - With Spring Boot and Kubernetes” (Manning). About Me
  3. Why Cloud Native? @SystematicGroup @vitalethomas

  4. The Three P’s of Cloud Native Applications Place Private Cloud

    Public Cloud Hybrid Cloud Properties Scalability Loose Coupling Resilience Manageability Observability Security Practices Automation Continuous Delivery DevOps @SystematicGroup @vitalethomas
  5. The Goals Speed Faster and fl exible delivery Cost Ef

    fi ciency and cost optimisation Scale Elasticity and dynamic scaling Resilience Availability and stability @SystematicGroup @vitalethomas
  6. 1. Application Server @SystematicGroup @vitalethomas

  7. 2 Embedded server 3 Imperative vs. Reactive @SystematicGroup @vitalethomas 1

    “Make JAR, not WAR” (Josh Long)
  8. @SystematicGroup @vitalethomas Embedded Server + JAR Packaging Embedded Server Blocking

    + Servlet API (Tomcat, Undertow, Jetty) Spring Web Embedded Server Non-Blocking + Project Reactor (Netty) Spring WebFlux Serverless Functions (AWS, Azure, GCP, Knative) Spring Cloud Functions
  9. Demo Embedded Server + JAR Packaging https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  10. 2. Containerization @SystematicGroup @vitalethomas

  11. 1 Don’t use fat JARs 2 Optimize build/runtime performance 3

    Don’t run as root or include secrets @SystematicGroup @vitalethomas
  12. Containerize Spring Boot Applications @SystematicGroup @vitalethomas Docker fi les Cloud

    Native Buildpacks Jib
  13. Demo Containerizing Spring Boot https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  14. 3. Kubernetes Deployment @SystematicGroup @vitalethomas

  15. 1 Define a Namespace manifest 2 Define a Deployment manifest

    3 Define a Service manifest @SystematicGroup @vitalethomas
  16. Demo Kubernetes Deployment https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  17. 4. Application Lifecycle @SystematicGroup @vitalethomas

  18. 1 2 3 Fast start-up, graceful shutdown Liveness and readiness

    probes Stateless and horizontally scalable @SystematicGroup @vitalethomas
  19. Liveness and Readiness Probes Application ALIVE? READY? NO NO Restart

    might help Restart won’t help @SystematicGroup @vitalethomas
  20. Demo Application Lifecycle https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  21. 5. Configuration @SystematicGroup @vitalethomas

  22. Code, Configuration, Credentials Code Con fi guration Deploy Credentials @SystematicGroup

  23. Configuration Strategies Spring Boot Properties Property fi les Command line

    arguments Environment variables Con fi guration Services Spring Cloud Con fi g Server Spring Cloud Consul Con fi g Spring Cloud Vault Spring Cloud Zookeeper Con fi g Cloud Platform Services Spring Cloud Alibaba Spring Cloud AWS Spring Cloud Azure Spring Cloud GCP Kubernetes Platform Con fi gMaps Secrets Environment Variables @SystematicGroup @vitalethomas
  24. Demo Con fi guration https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  25. Bonus: GitOps @SystematicGroup @vitalethomas

  26. GitOps - Cloud Native Operations https://www.weave.works/technologies/gitops/

  27. Demo GitOps https://github.com/ThomasVitale/cloud-native-spring-webinar-feb-2021 @SystematicGroup @vitalethomas

  28. GitOps - Configuration helm upgrade -i flux fluxcd/flux \ --set

    git.user=$GITHUB_USER \ --set git.email=$GITHUB_USER@users.noreply.github.com \ --set git.url=git@github.com:$GITHUB_USER/cloud-native-spring- webinar-feb-2021 \ --set git.path="deployment" \ --set git.branch="main" \ --namespace flux @SystematicGroup @vitalethomas
  29. What’s next? @SystematicGroup @vitalethomas

  30. II. Dependency management I. One codebase, one application III. Con

    fi guration, credentials, and code V. Design, build, release, run IV. Backing services VI. Stateless processes VIII. Concurrency VII. Port binding IX. Disposability XI. Logs X. Environment parity XII. Administrative processes XIV. Telemetry XIII. API fi rst XV. Authentication and authorization Beyond 12-Factors
  31. More Spring and Kubernetes Resilience Resilience4J Spring Cloud Circuit Breaker

    Distributed systems Spring Cloud Gateway Spring Cloud Stream Spring Security OAuth Reactive Spring WebFlux R2DBC Project Reactor Kubernetes Spring Boot Spring Cloud Kubernetes Skaffold @SystematicGroup @vitalethomas
  32. With Spring Boot and Kubernetes • 35% discount code, valid

    for all products in all format • mtpsystematic21 • mng.bz/8N5D Cloud Native Spring in Action www.thomasvitale.com @vitalethomas
  33. Thomas Vitale @vitalethomas thomasvitale.com Cloud Native With Spring Boot and

    Kubernetes Systematic - 10/02/2021 systematic.com