This image provide a toolset to interact with the Google Kubenetes Engine.
envsubst
Environment variables substitution CLIgcloud
Google Cloud SDK Clienthelm
Helm CLIjq
JSON processor CLIkubectl
Kubernetes CLIkustomize
Kustomize CLI
There is also a script activate-service-account
to simplify the
authentication with a service account.
→ Check out Docker Hub for available tags.
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>
"
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.
-
Where to get help: the Docker Community Forums, the Docker Community Slack, or Stack Overflow
-
Where to file issues: Issue Tracker
-
Maintained by: The skriptfabrik Team
-
Source of this description: Repository README.md