Replace Spring properties with environment variables in Kubernetes
We could override any springboot in runtime defining environment variables in kubernetes. For example, if we need to override loging level of our app defined in own application.properties like.
logging.level.org.springframework=DEBUG
We will define a new environment variable in snake_case like LOGGING_LEVEL_ORG_SPRINGFRAMEWORK
in our deployment definition as follow.
env:
- name: SPRING_PROFILES_ACTIVE
value: dev
- name: LOGGING_LEVEL_ORG_SPRINGFRAMEWORK
value: DEBUG