-
Notifications
You must be signed in to change notification settings - Fork 880
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
Vault agent can't authenticate using k8s 1.21 #562
Comments
Hi @Marc-Pons, this is related to hashicorp/vault#11953 and may be helpful to fix your authentication problems. Hope that helps! |
Hi, We encountered the same error after upgrading from AWS EKS to 1.21. We solved the error by setting issuer for Kubernetes authentication method:
|
I've tried with the following on EKS 1.21 without success:
The only way I got it working is by adding Edit: found thanks to previous post, issuer is actually the OIDC provider for EKS cluster: |
…on of disable_iss_validation=true (#237) - move HC tests into their own larger class so that we can test the engines too - workaround HC bug - add doc note - root cause hashicorp/vault-helm#562 and hashicorp/vault#11953
|
It's not working on Docker Desktop which at the time of this writing uses Kubernetes v1.21.4. Either setting The value of
UPDATE: Just tested on EKS, and it's the same. This time the |
Hi folks, we've collected a couple different ways to find the issuer on Kubernetes 1.21+ clusters here: https://www.vaultproject.io/docs/auth/kubernetes#discovering-the-service-account-issuer Using those instructions the issuer comes back on kind (1.21.1) and docker-desktop (1.21.3) as However, if setting |
oh well, in my case the issue was different indeed. It all started by the 1.21 changes, but it looks like with further testing I started to write |
As of Vault 1.9, the We've also detailed the options for configuring K8s auth with respect to the changes in K8s 1.21 here: https://www.vaultproject.io/docs/auth/kubernetes#kubernetes-1-21 And we also have some changes to K8s auth coming soon to make it easier to run Vault in K8s with short-lived tokens: hashicorp/vault-plugin-auth-kubernetes#122 Closing this for now, thanks for all your input! |
Thanks for the deprecation details @tvoran. Now my vault-agent can authenticate correctly without having to specify the issuer when configuring the auth method if I use K8S 1.21 on Kind. However, it is not working for me on AWS with K8S 1.21 if I don't specify the issuer. I am not sure why it is failing if My vault-agent is receiving a 403 when trying to authenticate against the vault server. On the vault server I observe the following error:
Do you have any clue about what could be going on? Thanks in advance! UPDATE: Just tried again specifying |
@Marc-Pons Glad you got it working on AWS! And yes, |
@tvoran we are currently using a very old version of vault (helm - 0.6.0) and have recently upgrade to EKS (1.21.5) .. Also we have spot instances so often we can see vault pods going down but we have 3 replicas, so until 1.20 EKS version we were good. After the upgrade i can see we have to keep updating the auth/kubernetes/config as mentioned here whenever a pod goes down. I understand there is a vault fix already present but is there a fix yet in vault helm which we can upgrade to. Also i could see disable_iss_validation="true" is not getting picked up even though it says success.
Also i don't see "disable_iss_validation" when i read it back.
API call
i see it's been fixed in this PR #695 -- 7 days ago did we came up with any new release version yet .. i can see 0.19.0 was release in Jan 20th, 2022. Nothing after that. @evanphx , @tvoran: can I go ahead and use main or should i wait for a new release from your side. |
@prasanjitshome Please don't at-mention random folks. |
Hi @prasanjitshome, these are probably good questions for our discuss forums: https://discuss.hashicorp.com/c/vault As for the question a new vault-helm release, we don't typically release a new version of vault-helm for every Vault release, since they aren't that tightly coupled version-wise. We recommend setting a specific Vault version in the user-specified overrides in the chart values when running in production: https://www.vaultproject.io/docs/platform/k8s/helm/configuration#image-1 So for example you can use vault-helm v0.19.0 and set My guess about not seeing
|
this is sorted as it was due to istio sidecar blocking the connections for auth. |
Describe the bug
Since I updated kind to 0.11, which by default uses k8s 1.21, my sidecar vault-agents can't authenticate with Vault showing the following error:
[ERROR] auth.handler: error authenticating: error="context deadline exceeded" backoff=1s
Using kind 0.11 and k8s 1.20, vault-agent authenticates correctly. The only fix I could find using k8s 1.21 is configuring the auth method specifying the issuer as follows:
Disabling the issuer validation with
disable_iss_validation=true
also works. I think the issue may be related to the following change introduced on k8s 1.21:The ServiceAccountIssuerDiscovery feature has graduated to GA, and is unconditionally enabled.
To Reproduce
Steps to reproduce the behavior:
2.1 Enable auth method:
vault auth enable kubernetes
2.2 Configure the auth endpoint:
2.3 Create a named role:
2.4 Configure Kubernetes creeating a ClusterRoleBinding:
Deploy a pod with vault-agent as sidecar using the configured auth method.
Check logs of vault-agent. You should see a periodic log that looks like:
[ERROR] auth.handler: error authenticating: error="context deadline exceeded" backoff=1s
Expected behavior
The documented steps to configure the auth method (https://www.vaultproject.io/docs/auth/kubernetes) should be working despite I am using k8s 1.21.
Environment
Chart values:
The text was updated successfully, but these errors were encountered: