Building tenant specific docker images using Jenkins & Deployment in kubernetes

4/30/2018

My Application Structure

I am developing a tenant based application in service oriented architecture with deployment using kubernetes and Jenkins. In my application , It contains 15-20 number of microservices developing using spring boot. The each microservice need to be deploy separately for different customers. If I have 5 customer, I need to deploy 15 microservice for these 5 customer.This is the description about my tenancy model.

Deployment Planning

For this application I am planning to use kubernetes and Jenkins for deployment and implementing CI/CD pipeline.

My Findings

The nature of my application is building the images for different customer from same code by using spring cloud config server active profile functionality. Means In my docker file , I am launching the particular image by defining which is the active profile. Like the following,

java -jar -Dspring.profiles.active=<Profile_Name> dbdata-0.0.1-SNAPSHOT.jar

Here I am configuring profile in config server. So here I am using same code for creating multiple images which belongs to each customer.

Confusion

If I am following this style, how I can create and launch different images from same code repository using Jenkins? Is possible to launch multiple images using Jenkins from same code repository?

In summary, how can I understand multiple image creating and deployment as per above application structure?

-- Jacob
jenkins
kubernetes

1 Answer

4/30/2018

As you have several microservices, it's better to use tools like Helm + Chartmuseum to simplify management of these services. In this case you will have individual release (and Kubernetes namespace) per tenant. You can use different docker images tags if different docker images per tenant is required.

As for Jenkins part, I don't see any problems (you can build any number of docker images from 1 repo):

  • create job to produce & upload docker image(s)
  • create job to produce & upload Helm chart(s)
  • create job(s) to deploy/update releases in Kubernetes

It's not required to build different docker images if they differ only in command line. This command line (or env variable) can be overridden in a Kubernetes resource description.

-- Igor Stepin
Source: StackOverflow