Skip to content
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

Get Credentials from Kubernetes Secret #3517

Closed
HknLof opened this issue Nov 30, 2021 · 2 comments
Closed

Get Credentials from Kubernetes Secret #3517

HknLof opened this issue Nov 30, 2021 · 2 comments
Labels

Comments

@HknLof
Copy link

HknLof commented Nov 30, 2021

Environment:
Kubernetes 1.21

  • Jib version:
    jib-core-0.20.0
  • Build tool: None
  • OS: Any on K8s

Description of the issue:
One task encountered is to build images, push images, and run these deploy these images on Kubernetes at runtime.

Problem:
DockerConfigCredentialRetriever.java is sufficient for setups where the authentication token is not changed. But not sufficient for a setup with rolling keys. So, once a given docker-registry secret changes, this means a volume with the given secret needs to be re-mounted / the pod restarted.

Expected behavior:
It would be great to have an implementation KubernetesConfigCredentialRetriever.java, which either links to a ServiceAccount or new KubernetesConfigCredentialRetriever(String kubernetesSecret) instance to retrieve the credentials from a local secret.

@mpeddada1
Copy link
Contributor

@HknLof There are a number of ways in which Jib gathers credentials. One of the ways is through reading the $HOME/.docker/config.json file. As described in this suggestion by @chanseokoh, if you follow the steps to mount a secret in a volume and copy/symlink the file to $HOME/.docker/config.json then that can be picked up by Jib.

Additionally, this documentation highlights GCR auth on GKE using Application Default Credentials. It describes how you can you can generate a JSON key from a service account, save the key as a secret and expose it through the GOOGLE_APPLICATION_CREDENTIALS env variable which will then be used by Jib.

Let us know if this what you're looking for.

@HknLof
Copy link
Author

HknLof commented Dec 1, 2021

@mpeddada1 thank you for the information. That, is how I am working with Jib right now. For now, this is sufficient. Probably we will have our own CredentialProvider for the use case, where registry tokens might change. Thanks, for the fast reply :)

@HknLof HknLof closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants