0

I have a spring boot app that has an application YAML file (src/main/resources/).

app:
  props:
    -
      key1: value
      key2: value
    - 
      key3: value
      key4: value
    -
      key5: value
      key6: value

I want to override the entire list of props in the deployment's env section (k8s). is there any way to do it in Kubernetes?

Bhushan
  • 25
  • 6

2 Answers2

1

Spring will automatically allow you to override properties via environment variables.

So if you want to change key3, then all you need to do is to create an environment variable called: APP_PROPS_1_KEY3 and you can override this value. This can be done via K8.

More here: https://stackoverflow.com/a/58186093/5563263

Loading
  • 1,098
  • 1
  • 12
  • 25
0

As per this SO, Assuming the App is deployed on Kubernetes with a Pod you can inject environment variables inside the container by either directly assigning them to the Deployment itself, or with a ConfigMap, Here in this Tutorial you have detailed info and steps about this process.

Adding the support links:

Here is the doc for :

  1. Expose Pod Information to Containers Through Environment Variables.
  2. Configure a Pod to Use a ConfigMap.
  3. Spring Boot features external configuration.
Hemanth Kumar
  • 2,728
  • 1
  • 4
  • 19