-
Notifications
You must be signed in to change notification settings - Fork 987
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
GCS storage - failing to fetch credentials in GKE using workload identity #4396
Comments
Yeah, I realize now that the logic there is not very good. Seems that we can also identify cloud environments by checking for |
I don't see anything google specific. AFAIK, GKE doesn't mount anything Google specific to pods (at least, nothing beyond what Kubernetes does) There is this file which I think is from the container itself? cat /etc/cloud/build.info
serial: 20240911.1 |
Ah, I see now that |
Yes - the feature works fine once I apply the workaround (of creating (i don't have curl/wget on the container to directly test this) IMO there's no need to explicitly check for the existence of the metadata server, per the GCP docs, it is always last in priority (so, if By the way, I haven't seen any reference to |
Thanks for providing the reference to the correct spec, Daniel 👏🏼 |
btw, you mentioned |
Sure, I can try fixing (though my C++ is a bit rusty) Regarding This can be demonstrated by opening a shell into the container (root) and running: setpriv --reuid=dfly --regid=dfly --clear-groups -- bash
bash: /root/.bashrc: Permission denied
dfly@dragonflydb-79cfb45bff-29d5t:/data$ echo $HOME
/root |
Thank you for the explanation. For now, I will not proceed with a fix and will wait for you to check. Please let me know if you prefer a different course of action. As you saw, all the relevant code is located in the "helio" repo. I typically use "gcs_demo" for manually checking issues related to Google Cloud Storage access. Please let me know if you need any help with building helio. |
Describe the bug
Dragonfly with GCS storage, fails to initialize when running within a GKE (Kubernetes) pod configured to authenticate via workload identity.
Looking at the relevant code
https://github.com/romange/helio/blob/493804db4110cf1631f787dd14484efc57f9575d/util/cloud/gcp/gcs.cc#L203C1-L227C1
The folder
~/.config/gcloud
(or the file~/.config/gcloud/gce
) doesn't exist when using GKE (and I assume other containerized envs like Cloud Run)IMO, a solution here is to assume
is_cloud_env = True
if~/.config/gcloud
doesn't exist.Furthermore, mounting the file
True
to/home/dfly/.config/gcloud/gce
still yields the same error. (Even after creating and chowning the entire/home/dfly
folder todfly
)Adding
--reset-env
to theexec setpriv
command inentrypoint.sh
fixes the problemTo Reproduce
(GKE instructions, I assume Cloud Run, or using VMs might be simpler?)
gs://my-dragonfly-bucket
andmy-service-account
accordinglyExpected behavior
Dragonfly should fetch the creds via the metadata endpoint despite
~/.config/gcloud
not existingEnvironment (please complete the following information):
The text was updated successfully, but these errors were encountered: