spring cloud kubernetes secrets not loaded

5/4/2020

I want to use the potential of spring cloud kubernetes secret but apparently the configuration does not work. In the pom I added the reference to

spring-cloud-starter-kubernetes-config

Reading the ConfigMap works regularly.

In my application yaml I have

spring:
   application:
      name: myapp
   cloud:
      kubernetes:
         secrets:
            enabled: true
            paths: /secret

but when the application starts there is no trace of this configuration. In fact, even if I define the properties in the yaml, they are not overwritten by the secrets. Kubernetes is configured correctly, in fact it is possible to read the secrets also from the environment variables.

I also checked that the volume is mounted on right path.

The spring cloud documentation is very sparse with examples. Am I missing something for you to use the secrets?

edit: other possible solutions:

I also tried

    secrets:
       enabled: true
       name: my-secrets-name
       namespace: default
       sources:
        - namespace: default
          name: my-secrets-name

Same result.

-- ciro
kubernetes-secrets
spring-cloud-kubernetes

0 Answers