Skip to content

Google Kubenetes Engine Client Toolset Docker Images

License

Notifications You must be signed in to change notification settings

skriptfabrik/docker-hub-gke-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Kubernetes Engine Tools

This image provide a toolset to interact with the Google Kubenetes Engine.

There is also a script activate-service-account to simplify the authentication with a service account.

Supported tags and respective Dockerfile links

→ Check out Docker Hub for available tags.

How to use this image

Start the interactive shell:

docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd)":/app \
    skriptfabrik/gke-tools \
    bash

Authorizing access to the Google Cloud Platform and logging in to the Google Container Registry using docker:

docker run \
    --rm \
    --interactive \
    --tty \
    --volume ~/.config/gcloud:/root/.config/gcloud \
    skriptfabrik/gke-tools \
    gcloud auth login

docker run \
    --rm \
    --volume ~/.config/gcloud:/root/.config/gcloud \
    skriptfabrik/gke-tools \
    gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.io

Authorizing access to the Google Cloud Platform and using the tools within a CI:

docker run \
    --rm \
    --volume "$(pwd)":/app \
    --env GKE_SERVICE_ACCOUNT_KEY=<BASE64-ENCODED-SERVICE-ACCOUNT-JSON-DATA> \
    --env GKE_CLUSTER_NAME=<CLUSTER-NAME> \
    --env GKE_REGION=<GKE-CLUSTER-REGION> \
    --env GKE_ZONE=<GKE-CLUSTER-ZONE> \
    skriptfabrik/gke-tools \
    sh -c " \
        activate-service-account; \
        <ALL THE FANCY COMMAND LINE TOOL CALLS>
    "

Aa an alternative mount the service account credentials:

docker run \
    --rm \
    --volume "$(pwd)":/app \
    --volume ./service-account.json:/root/.config/gcloud-credentials/service-account.json \
    --env GKE_CLUSTER_NAME=<CLUSTER-NAME> \
    --env GKE_REGION=<GKE-CLUSTER-REGION> \
    --env GKE_ZONE=<GKE-CLUSTER-ZONE> \
    skriptfabrik/gke-tools \
    sh -c " \
        activate-service-account; \
        <ALL THE FANCY COMMAND LINE TOOL CALLS>
    "

Configuration

The image can be configured by using environment variables.

Environment Description
GKE_SERVICE_ACCOUNT_KEY The base64 encoded content of the Google service account key json file which is provided by Google.
GKE_CLUSTER_NAME The name of the Kubernetes cluster.
GKE_REGION* The region of the Kubernetes cluster.
GKE_ZONE* The zone of the Kubernetes cluster.

* Either one of these environments have to be defined. If both are defined, GKE_REGION will be used.

If necessary, the configuaration of all tools can be mounted as volume.

Tool Configuration path within the container
Google Cloud SDK Client /root/.config/gcloud
Google Cloud Credentials /root/.config/gcloud-credentials
Helm /root/.helm
Kubernetes /root/.kube

Instead of injecting the Google Cloud Credentials, the credential file can also be set as first argument to the activate-service-account script.

Quick reference