Spring Cloud kubernetes - secret

4/28/2020

I want use kubernetes secret inside my spring boot application.

I read about spring cloud kubernetes at this link:

https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/1.1.2.RELEASE/reference/html/#secrets-propertysource

From what I understand the best practice is to read the secret as file from mounted volume in pods instead of using API.

So if I want to apply best practices, is it not recommended to use SecretsPropertySource?

I created a service and a secret according to kubernetes documentation.

But how Spring Cloud can help me to read secret files? I need DiscoveryClient to get information about file path?

This example

https://developers.redhat.com/blog/2017/10/04/configuring-spring-boot-kubernetes-secrets/#secrets-as-files

injects the secrets inside env variables. It's a good choise?

-- ciro
google-cloud-platform
kubernetes
kubernetes-secrets
spring

0 Answers