Sign inSign up

toolkitbox/gcloud

By toolkitbox

Updated 24 days ago

DevOps toolkit - gcloud client

Image
0

1.2K

toolkitbox/gcloud repository overview

Google Cloud SDK (gcloud)

GitHub Stars GitHub Issues Docker Pulls

📢 Found an issue or want to request a new tool? Open an issue on GitHub

Command line client for Google Cloud Platform.

Quick Start

Docker
# Interactive mode
docker run -it --rm \
  ghcr.io/pabpereza/toolkitbox/gcloud:latest

# Login interactively
docker run -it --rm \
  -v ~/.config/gcloud:/root/.config/gcloud \
  ghcr.io/pabpereza/toolkitbox/gcloud:latest \
  gcloud auth login

# Run single command with cached credentials
docker run --rm \
  -v ~/.config/gcloud:/root/.config/gcloud \
  ghcr.io/pabpereza/toolkitbox/gcloud:latest \
  gcloud projects list

# With service account key
docker run --rm \
  -v /path/to/key.json:/credentials.json \
  -e GOOGLE_APPLICATION_CREDENTIALS=/credentials.json \
  ghcr.io/pabpereza/toolkitbox/gcloud:latest \
  gcloud auth activate-service-account --key-file=/credentials.json
Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: gcloud-client
spec:
  containers:
  - name: gcloud-client
    image: ghcr.io/pabpereza/toolkitbox/gcloud:latest
    command: ["sleep", "infinity"]
    env:
    - name: GOOGLE_APPLICATION_CREDENTIALS
      value: /var/secrets/google/key.json
    volumeMounts:
    - name: gcp-credentials
      mountPath: /var/secrets/google
      readOnly: true
  volumes:
  - name: gcp-credentials
    secret:
      secretName: gcp-credentials

Description

Google Cloud SDK is a set of tools for Google Cloud Platform. It includes gcloud, gsutil, and bq command-line tools for managing GCP resources, Cloud Storage, and BigQuery.

Installation

This component downloads and installs the Google Cloud SDK from the official distribution.

Included Tools

ToolDescription
gcloudMain CLI for GCP resources
gsutilCloud Storage management
bqBigQuery command-line tool

Basic Usage

# Initialize and configure
gcloud init

# Login
gcloud auth login

# List projects
gcloud projects list

# Set default project
gcloud config set project my-project-id

# List compute instances
gcloud compute instances list

# List GKE clusters
gcloud container clusters list

# Upload to Cloud Storage
gsutil cp file.txt gs://my-bucket/

# Run BigQuery query
bq query "SELECT * FROM dataset.table LIMIT 10"

Common Options

OptionDescription
--projectGCP project ID
--regionCompute region
--zoneCompute zone
--formatOutput format (json, yaml, table, csv)
--quiet, -qDisable interactive prompts
--verbosityLogging verbosity (debug, info, warning, error)

Service Account Authentication

For non-interactive authentication:

# Activate service account
gcloud auth activate-service-account \
  --key-file=/path/to/service-account-key.json

# Set project
gcloud config set project my-project-id

Official Documentation

Tag summary

Content type

Image

Digest

sha256:74c01a4e9

Size

152.7 MB

Last updated

24 days ago

docker pull toolkitbox/gcloud