-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Maven Profile To Config Server To Include spring-vault-core #1848
Comments
Are using the docker image for the config server from DockerHub? Can you provide your deployment yaml and any other configuration you are setting for the config server? |
Hey @ryanjbaxter, Sure, here’s the information you requested: Docker Image:
The resulting JAR file is then executed with Java. Deployment YAML:
it works when we provide this as well
We have attached required service account and roles to this deployment (even joined this in role binding). |
Hi @ryanjbaxter, I had a couple of questions that I’d love your input on:
Can we configure the order of propertySources so that Kubernetes Secrets appear at the top of the list? This would ensure that values from Secrets take precedence, allowing other configurations to resolve their values using Secrets. |
I am going to focus on one issue at a time we can come back to your other questions after we have a good idea about your original issue. You said
So does that mean if you set that environment variable everything works on Kubernetes? |
Yes, But that's the static token, and i dont want to provide that in env vars. |
A couple more questions.
This would set the authentication method to kubernetes not token. That is a little confusing to me. |
|
Are you adding it? Because it is optional by default.
Why are you setting it to be |
When building the spring-cloud-config-server as a vanilla setup in my Dockerfile, I am using the default POM.xml from the Spring Cloud Config Server repository. Although spring-vault-core is an optional dependency, it still gets included in the classpath by default. However, in the case of spring-cloud-kubernetes-config-server, the optional dependency does not get added to the classpath, causing token refresh failures. As a workaround (kind of hacky), I manually added the spring-vault-core dependency to the Kubernetes Config Server POM.xml, which resolved the problem and allowed automatic token refresh:
While this approach works, i guess manually modifying the POM is not good. @ryanjbaxter, could you please provide your insights on this as well? Your guidance would be greatly helpful.
|
Please let me know if its a correct approach and can be added. |
Can you please provide me with a sample of your project than either as a git repo or zip file so I can look at it?
Not at the moment, we are not going to add spring-vault-core as a dependency when it is very specific to the vault use case. In addition you can do TOKEN authentication without spring-vault-core, by supplying the token as a header in the request to the config server, see https://docs.spring.io/spring-cloud-config/reference/server/environment-repository/vault-backend.html. This is why you are seeing the error when deploying to k8s. The only reason it works in your vanilla config server is because somehow spring-core-vault is on the classpath (which it is not by default so it is somehow being added). Please open 2 separate issues for the other questions/requests you had. |
Thank you for the clarification. My vanilla Config Server setup is simply a Dockerfile where I build the Config Server using mvn package and then run the JAR. You can find the Dockerfile here
I have created a PR by forking the Spring Cloud Kubernetes Config Server, to introduce a For my other questions, I'll open separate issues as suggested. |
OK that makes sense. Typically when people create a config server they ass the dependency
And then add I have added comments to #1864. |
Great! Thanks |
Description:
I am currently using Spring Cloud Kubernetes Config Server (v3.2.0), but I am facing an issue with HashiCorp Vault token renewal. When running the Spring Cloud Config Server normally (v4.2.0), the Vault token renewal activity is automatically triggered. However, with the Spring Cloud Kubernetes Config Server (v3.2.0), the token renewal is not triggered, resulting in the missing
X-Config-Token
header in requests.Expected Behavior:
The Vault token renewal should be automatically triggered when using Spring Cloud Kubernetes Config Server, and the
X-Config-Token
header should be included in the requests.Environment:
Investigation:
After further investigation, I discovered that the
spring-vault-core
dependency must be included in the application's classpath to triggerLifecycleAwareSessionManager
(which is responsible for the token renewal process).On Spring Cloud Config Server (v4.2.0), I see the following log line:
o.s.v.a.LifecycleAwareSessionManager - Scheduling Token renewal
However, this log line is not seen when using Spring Cloud Kubernetes Config Server (v3.2.0), indicating that the token renewal is not being triggered.
logs:
Can someone help with this issue and provide guidance on how to enable Vault token renewal for Spring Cloud Kubernetes Config Server (v3.2.0)?
The text was updated successfully, but these errors were encountered: