Google Cloud Platform (GCP) Reference

Kip Landergren

(Updated: )

My cheat sheet for Google Cloud Platform covering terminology, common commands, and links to the most helpful documentation resources.

Contents#

Products#

Network Services#

Cloud DNS#

Tooling#

gcloud CLI tool for managing Google Cloud Platform resources
gsutil CLI tool for managing Cloud Storage

gcloud#

components#

gcloud help components
gcloud components update
gcloud components reinstall

compute#

addresses#

gcloud compute addresses --help
gcloud compute addresses list
gcloud compute addresses create example-com-static-ip
gcloud compute addresses create example-com-global-static-ip --global
gcloud compute addresses create example-com-regional-static-ip --region=us-west2
gcloud compute addresses delete example-com-static-ip

forwarding-rules#

gcloud compute forwarding-rules --help
gcloud compute forwarding-rules list
gcloud compute forwarding-rules describe NAME
gcloud compute forwarding-rules delete NAME

instances#

gcloud compute instances create \
  --labels component=frontend
gcloud compute instances update \
   --update-labels component=frontend

gcloud compute instances update \
   --remove-labels component
gcloud compute instances describe
gcloud compute instances list \
   --filter labels.component=frontend

gcloud compute instances list \
   --filter="labels.component=frontend AND labels.environment=production AND status=RUNNING" \
   --format="value(name)"

config#

View, set, and unset properties used by the Google Cloud SDK. Reduces the amount of flags needing to be passed on other commands.

gcloud config --help
gcloud config list
gcloud config set project example-com
gcloud config set compute/region us-west2
gcloud config unset compute/region

dns#

gcloud dns --help

help#

gcloud --help

iam#

gcloud iam --help
gcloud iam roles --help
gcloud iam service-accounts --help

info#

gcloud info

Docker Integration#

Register gcloud as credential helper:

gcloud auth configure-docker

Tag local image:

docker tag LOCAL-IMAGE-NAME gcr.io/PROJECT-NAME/IMAGE-NAME:TAG

Push to GCR:

docker push gcr.io/PROJECT-NAME/IMAGE-NAME:TAG

Pull from GCR:

docker pull gcr.io/PROJECT-NAME/IMAGE-NAME:TAG

Pulling Image to GKE from GCR#

For a newly created cluster, things should “just work” as the service account should be provisioned with permissions that allow read-only access to dev storage. If not, review the service account permissions and access policy on the bucket storing the images.

Quick steps:

Creating a Cluster#

Notes below are based on creating a cluster through the Cloud Console.

Kubernetes Versions: Standard and Advanced#

“Advanced” has an improved SLA and reliability. More info in this blog post.

Regional vs Zonal#

From the official documentation:

“A regional cluster provides a single static endpoint for the entire cluster and spreads your cluster's Pods across multiple zones of a given region. This allows you to access the cluster's control plane even during an outage or downtime involving one or more (but not all) individual zones.”

As of August 2019 you cannot switch a Zonal cluster to Regional. If you choose Zonal, the zone is permanent.

Master Version#

Choose the Kubernetes version appropriate to your application and any dependencies it may have.

Node Pools#

Select “More Options” to better customize.

Network Configuration#

HTTP Load Balancing#

If disabled, default Ingress objects will not be created using Google Cloud Load Balancer. However, a network load balancer will still be provisioned via a forwarding-rule for any IP address to target-pool mapping. This will incur an hourly charge.

Connecting to Cluster#

Copy the command from the Cloud Console button “Connect” to update your local kubeconfig file with appropriate credentials and endpoint information.

Generally of form:

gcloud container clusters get-credentials CLUSTER-NAME

Terminology#

address#
1.

An IP address, may be ephemeral or reserved.

Related:

bucket#
1.

A container for your objects; cannot be nested within another.

Related:

forwarding-rule#
1.

Directs traffic matching an address to a forwarding target, like a target-pool.

Related:

guest#
1.

The virtualized environment running on top of the hypervisor.

Related:

host#
1.

The physical machine and software running the hypervisor.

Related:

label#
1.

A key value pair used to organize resources; flows through to billing.

Related:

network tag#
1.

Key added to resource for use in networking products (like firewalls)

Related:

object#
1.

The piece of data stored.

Related:

region#
1.

A specific geographic location where your resources run (e.g. us-west1)

Related:

tag#
1.

A key value pair used to manage access to resources; integrated with IAM policies.

Related:

target-pool#
1.

Load-balanced pool of virtual machine instances.

Related:

virtual machine (VM)#
1.

A computer whose resources—which would otherwise be hardware the operating system interacts with—are virtualized.

Related:

zone#
1.

An isolated location within a region; zone name takes the form <region>-<zone suffix> (e.g. zone us-west1-a is within region us-west1)

Related:

External Links#

Reference#

Tooling#