7 Kubernetes fundamentals for Spring Boot

 

This chapter covers

  • Moving from Docker to Kubernetes
  • Deploying Spring Boot applications on Kubernetes
  • Understanding service discovery and load balancing
  • Building scalable and disposable applications
  • Establishing a local Kubernetes development workflow
  • Validating Kubernetes manifests with GitHub Actions

In the previous chapter, you learned about Docker and the main characteristics of images and containers. With Buildpacks and Spring Boot, you can build a production-ready image in one command, without even having to write your own Dockerfile or install additional tools. With Docker Compose, you can simultaneously control multiple applications, which is convenient for architectures like microservices. But what if a container stops working? What if the machine where your containers are running (the Docker host) crashes? What if you want to scale your applications? This chapter will introduce Kubernetes into your workflow to address issues that Docker alone cannot.

As a developer, it’s not your job to configure and manage a Kubernetes cluster. You would probably use either a managed service offered by a cloud provider such as Amazon, Microsoft, or Google, or a service managed on premises by a specialized team in your organization (commonly known as the platform team). For now you’ll use a local Kubernetes cluster provisioned with minikube. Later in the book you’ll use a managed Kubernetes service offered by a cloud provider.

7.1 Moving from Docker to Kubernetes

7.1.1 Working with a local Kubernetes cluster

7.1.2 Managing data services in a local cluster

7.2 Kubernetes Deployments for Spring Boot

7.2.1 From containers to Pods

7.2.2 Controlling Pods with Deployments

7.2.3 Creating a Deployment for a Spring Boot application

7.3 Service discovery and load balancing

7.3.1 Understanding service discovery and load balancing

7.3.2 Client-side service discovery and load balancing

7.3.3 Server-side service discovery and load balancing

7.3.4 Exposing Spring Boot applications with Kubernetes Services