简体   繁体   中英

How can I deploy a kubernetes replica pods with different spring profiles

I have spring boot application and deployed in kube.netes with 4 replica pods configurations. Now I have spring profiles: api and scheduler . When api spring profile is active then only pods will run those apis and when scheduler profile is active the pods will run the scheduler code. Now I want 2 of my pods to run with api and other 2 pods with scheduler spring profile. How can I achieve that in kube.netes?

One of the option is to define two pod yaml and override the docker file CMD and entrypoint. Yaml file 'command and args' will override whatever mention in docker's Entrypoint.

For api container

  spec:
  containers:
   - name: api-container
     image: nameOfImage
     command: ["java"]
     args: ["-jar", "application.jar", "--spring.profiles.active=api"]

Similarly you can define for scheduler container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM