In this article, we’ll build Java microservices that use ConfigMaps, see how the ConfigMaps are used, change the config and roll out the updated config to the services. Kubernetes is all about orchestration so we’ll build several services and make config changes that apply across multiple services. You can code along with the article or clone the project from GitHub .

You may also enjoy Linode’s .

Pre-Requisites

We will need to containerize our microservices to run them in Kubernetes—we’ll use Docker (v18.03.0-ce) for this. We’ll use Minikube(v0.24.1) to sandbox with Kubernetes locally. Later (optionally) we’ll also use Helm (v2.8.2).

Building a Service

We want each service to clearly identify itself and what configuration it is in. For this we’ll build Spring Boot web applications that respond to HTTP requests, generating an initial project from the Spring Initializr with Web and Actuator (for health checks) dependencies:

We start by building Optimus Prime - we want services that we can reconfigure and clearly see when we’ve reconfigured them, so Transformers are a good illustration (using characters from writeups.org). The idea is to be able to respond to a web request with a page like:

We can be ready to build multiple Transformers by putting the optimus-prime directory from the Initializr inside the directory we’ll use for the Transformers project (I’ve called the parent directory ‘configmaps-transfomers’). Then import into your IDE (either the parent directory or just optimus for now).

#java #tutorial #microservices #docker #kubernetes #deployment #spring boot 2 #helm #configmaps

Configuring Java Apps With Kubernetes ConfigMaps and Helm
3.00 GEEK