spring-cloud-config icon indicating copy to clipboard operation
spring-cloud-config copied to clipboard

Document spring-vault-core as a dependency to use the vault repository

Open venkateshdatta1993 opened this issue 6 years ago • 3 comments

Description:

  • Spring Boot Version : 2.2.7

  • Spring Cloud Version: Hoxton.SR4

Kubernetes Service Acccount based authentication doesn't work even when all the corresponding properties are specified.

application.properties:

#Server port
server.port = 8888
spring.profiles.active=vault

#Vault prod
spring.cloud.config.server.vault.host=vault.domain.org
spring.cloud.config.server.vault.scheme=https
spring.cloud.config.server.vault.backend=<backend>
spring.cloud.config.server.vault.port=443
spring.cloud.config.server.vault.profile-separator=-
spring.cloud.config.server.vault.default-key=<defaultKey>
spring.cloud.config.server.vault.authentication=KUBERNETES
spring.cloud.config.server.vault.kubernetes.role=<rolename>
spring.cloud.config.server.vault.kubernetes.kubernetes-path=kubernetes
spring.cloud.config.server.vault.kubernetes.service-account-token-file=/var/run/secrets/kubernetes.io/serviceaccount/token
spring.cloud.config.server.vault.kv-version=2
logging.level.org.springframework.web=DEBUG

Token based authentication for Vault works perfectly, but when Kubernetes Service Account based authentication is used, below error is thrown when a Get call is made to the config server

There was an unexpected error (type=Bad Request, status=400). Missing required header in HttpServletRequest: X-Config-Token

This issue gets fixed upon adding the below dependency to the project POM.

<dependency>
	<groupId>org.springframework.vault</groupId>
	<artifactId>spring-vault-core</artifactId>
</dependency>

Is this because "spring-vault-core" dependency has been marked as optional in the spring-cloud-config-server pom.xml?

However, the pom change still doesn't solve the issue completely. The first request made to config server fails. The first request error has already been reported here

Please help me out here and let me know if there there's anything I'm missing.

venkateshdatta1993 avatar May 08 '20 16:05 venkateshdatta1993

spring-vault-core is optional and needs to remain that way as not all projects use it.

spencergibb avatar May 08 '20 16:05 spencergibb

@spencergibb in that case I guess it would be helpful to update the documentation saying for kubernetes service account authentication to work, one would have to include spring-vault-core as well in the project POM

please let me know your thoughts.

venkateshdatta1993 avatar May 10 '20 14:05 venkateshdatta1993

I checked the current Vault backend documentation and found that it already documents spring-vault-core as a dependency for authentication methods other than token-based authentication, including Kubernetes authentication. Both Maven and Gradle dependency examples are also provided.

It appears that the original request may have been addressed by the documentation updates in PR #2042.

Could a maintainer please confirm whether any further changes are needed, or whether this issue can be closed?

yashdotdev13 avatar Oct 29 '26 15:10 yashdotdev13