<p>I'm new to Hashicorp Vault. I am wondering if there is a way to take advantage of the SPIFFE protocol to automatically authenticate with Vault, so based on a vault client's mTLS certificate, a workload in Kubernetes/Istio can access Vault as a specific user (entity?) or group. The requesting k8s workload would only have access to Vault secrets based on its SPIFFE identity's Vault permissions.</p>
<p>I'm hoping that no Vault credentials (tokens, passwords, etc) would need to be passed and that access would be granted purely on the mTLS connection and the SPIFFE protocol. Is something like this possible? What are the options if Vault lives outside of the Kubernetes cluster (and therefore can't have an Istio sidecar)?</p>
<p>If what I'm asking is not possible, a less ideal solution would be to update the application code to somehow authenticate with Vault based on the pod's k8s Service Account. What are the options that Vault provides to do this type of thing? Are there any good resources regarding this?</p>
<p>I appreciate any advice you have to offer.</p>

Joe J
<p>I have no knowledge about using SPIFFE for Vault authentcation, but I agree that it could be interesting (I'm not sure whether <a href="https://www.vaultproject.io/docs/auth/cert" rel="nofollow noreferrer">https://www.vaultproject.io/docs/auth/cert</a> could help, but I never tried that).</p>
<p>As far as I know, the general way of integrating Kubernetes with Hashicorp Vault is described in <a href="https://www.vaultproject.io/docs/auth/kubernetes" rel="nofollow noreferrer">https://www.vaultproject.io/docs/auth/kubernetes</a> . It does not really matter where Vault is deployed: it can be inside the same Kubernetes cluster, in the same service mesh, or it can be a completely unrelated entity (e.g., a dedicated instance deployed on some random VM).</p>
<p>You basically define roles and policies on Vault, which are mapped to specific kubernetes service accounts and namespaces, and then the Kubernetes pod will be able to authenticate with the JWT that is associated to its service account.</p>
<p>Once Vault is setup and you can authenticate with Kubernetes pods, you can have any wrapper around it. People are trying to do this in different ways, but one possibility would be <a href="https://www.hashicorp.com/blog/injecting-vault-secrets-into-kubernetes-pods-via-a-sidecar" rel="nofollow noreferrer">https://www.hashicorp.com/blog/injecting-vault-secrets-into-kubernetes-pods-via-a-sidecar</a> . Personally, I'm using <a href="https://github.com/postfinance/vault-kubernetes" rel="nofollow noreferrer">https://github.com/postfinance/vault-kubernetes</a> because it fits my needs quite well.</p>
<p>The important part is setting up Vault to support Kubernetes properly: make sure to double check that first, before getting into any of these Kubernetes packages that try to fetch secrets.</p>
