Open arimaverick opened 2 years ago
Exactly the same issue here. Seems secretproviderclass is not creating the secret when mounting volume.
Experiencing the same exact issue - can successfully see mounted secrets within the pod but kubernetes secret object not being created when mounting volume for a env var. pod is stuck in creation.
Experiencing the same exact issue
Just in case it works for someone. I fixed it by enabling syncsecret on helm instantiation.
resource "helm_release" "secret_csi_driver" { name = "secret-csi-driver" repository = "https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts" chart = "secrets-store-csi-driver" set { name = "syncSecret.enabled" value = "true" } depends_on = [ module.cluster ] }
I just upgraded my helm install with the following:
helm upgrade --install -n kube-system --set syncSecret.enabled=true csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver
Even with this change the secret is still not being created from the volume mount, maybe I'm missing something.
@flaviops I had the same issue and setting syncSecret.enabled=true
got me one step closer to the solution (thanks, @dmirallestl!). In particular, I ran the following to look at the cluster events:
kubectl get events --sort-by='.lastTimestamp' -A
...
FailedToCreateSecret pod/<redacted> failed to get data in spc <redacted>/eric-test-secret for secret <redacted>, err: file matching objectName SOME_ENV_VAR not found in the pod
Have you looked at the events to see if maybe you're running into the same issue?
I just upgraded my helm install with the following:
helm upgrade --install -n kube-system --set syncSecret.enabled=true csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver
Even with this change the secret is still not being created from the volume mount, maybe I'm missing something.
I noticed that the ClusterRole is missing permissions to get/create/patch secrets
Add the following permissions to your ClusterRole secretproviderclasses-role
:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- patch
- create
Also, the secret name has to be referenced somewhere in your Pod spec (in env
for example).
Have you looked at the events to see if maybe you're running into the same issue?
It was a similar problem, thanks for the help
I want to pass the aws secrets manager secret as an environment variable to the eks container. However even after correctly volume mounted the secret, the kubernetes secret could not be created from the volume mount.
I am using the roles and service account mentioned in the document.
To Reproduce Here is my secretprovider class:
My deployment manifest section where I am passing the secret as an Environment variable:
However the Pod goes to CreateContainerConfigError state and the following error was encountered:
Expected behavior The secret should be created and passed as an environment variable to the kubernetes container.
Additional context As mentioned in the description above I can though retrieve the secret in the volume mounted:
Thanks.