gcloud-kubectl is a Docker image to authorize kubectl command line tool, to connect to a Kubernetes cluster running on Google Cloud.
gcloud-kubectl container exposes SSH port to make it possible to execute kubectl
commands remotely.
SSH_KEY
Public RSA key file authorized to connect to container via SSH portKUBE_AUTH
Google service account json key file with privileges to manage KubernetesKUBE_NAME
Kubernetes cluster name to connect toKUBE_ZONE
Kubernetes cluster location zone
Start container by mounting the volume from local file system containing public RSA key and Google service account json key (/config in this example) into /auth directory inside the container.
docker run --rm \
-v /config:/auth \
-e SSH_KEY=/auth/id_rsa.pub \
-e KUBE_AUTH=/auth/gcloud-auth.json \
-e KUBE_NAME=kubernetes \
-e KUBE_ZONE=us-central1-f \
-ti crunchgeek/gcloud-kubectl
version: "3"
services:
gcloud_sdk:
image: crunchgeek/gcloud-kubectl
volumes:
- /config/:/auth
environment:
- SSH_KEY=/auth/id_rsa.pub
- KUBE_AUTH=/auth/gcloud-auth.json
- KUBE_NAME=kubernetes
- KUBE_ZONE=us-central1-f