Vault Agent Injector and Linkerd compatibility issue #10791
-
Hello everyone, I'm currently facing an issue with my Kubernetes environment where I'm using HashiCorp's Vault Agent Injector to inject secrets into my applications, and I'm trying to add Linkerd to enable mTLS for all my apps. After injecting Linkerd into my applications, some pods are failing to start. The logs indicate that the issue is related to the vault-agent-init container:
I suspect that the Linkerd proxy is interfering with the communication between the Vault Agent and the Vault server. I tried using the config.linkerd.io/skip-outbound-ports annotation to bypass the Linkerd proxy for the Vault server's communication, and it does work. However, I would like to know if there's a way to configure the Vault Agent Injector and my applications to work with Linkerd's mTLS without skipping the outbound ports. Any guidance or suggestions on how to properly configure this setup would be greatly appreciated. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is a generic issue for linkerd and all meshes. If the initContainer doing ipTables rerouting runs before another initContainer that makes http calls, the second will fail because the proxy isn't up (and in a chicken egg fashion CANNOT be up until all initContainers succeed) In our environment we use helm charts for all apps and directly inject the vault initContainer there. That guarantees it runs first. If you are using mutating webhooks only though, this may be difficult to achieve, though maybe linkerd or vault has a "prepend" or "append" choice. Otherwise as I recall mutating webhooks run serially and alphabetically, which is not terribly reliable, but is another option |
Beta Was this translation helpful? Give feedback.
-
That will work until some mutator after that changes the order |
Beta Was this translation helpful? Give feedback.
The fix was easier than I thought.
I just had to use vault.hashicorp.com/agent-init-first: "true" annotation to make my vault injector run before linkerd.