I'm setting up our CI (Jenkins pipeline) to deploy apps to a GKE cluster. Our Jenkins sever is running external to GKE or any Google Cloud infrastructure. I'm thinking of using a docker image with helm and kubectl to deploy, but need to set up credentials. On my local dev machine, I authenticate with:

gcloud container clusters get-credentials [CLUSTER_NAME]

What would be the best way of setting up credentials for a Jenkins job? Do I have to install and use the gcloud tools on Jenkins, or is there another approach?

1 Answer 1


The easiest approach does appear to be to use gcloud, as trying to get a kubeconfig without it proved tricky.

Fortunately, gcloud, kubectl and helm are available as a single docker image kiwigrid/gcloud-kubectl-helm. For example:

docker run -it --rm --volume ./gcp-key-file.json:/data/gcp-key-file.json:ro kiwigrid/gcloud-kubectl-helm:2.11.0-224.0.0 bash
gcloud auth activate-service-account --key-file=/data/gcp-key-file.json
gcloud container clusters get-credentials dev-cluster --project <project name> --zone <zone>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.