The first decision in placing a workload on Google Cloud is which compute surface to run it on.
The platform offers a layered set of options that trade control for operational burden:
- Compute Engine for full virtual machines
- Google Kubernetes Engine for orchestrated containers
- Cloud Run for request-driven and run-to-completion containers without node management
- Cloud Run functions for single-purpose handler snippets
Knative serving sits inside Cloud Run as the open-source API surface that powered the original Cloud Run for Anthos product, retained for users who want portable Knative manifests across clusters.
Each layer adds abstraction, and each abstraction removes a class of tasks (kernel patching, node-pool sizing, container packaging) at the cost of a class of options (custom kernel modules, GPU pinning rules, side-car privilege levels).
How it works
Compute Engine gives you the lowest-level surface short of physical hardware.
You pick a machine family (E2, N2, N4, C4 for general purpose; C2, C3 for compute-optimized; M2, M3 for memory-optimized; A3, G2 for accelerator workloads), pick a disk layout, choose a network, attach a service account, and SSH in.
The trade-off is operational: you patch the OS, you size the disks, you build the AMI-equivalent custom image.
Compute Engine fits:
- lift-and-shift migrations
- third-party software that cannot run in containers
- GPU and TPU workloads with bespoke driver requirements
- anything that needs a persistent host filesystem beyond Persistent Disk semantics
Google Kubernetes Engine wraps Compute Engine nodes behind the Kubernetes API.
You define Pods, Deployments, Services, and Ingress objects; GKE schedules them onto nodes; the control plane is fully managed. Two flavors exist:
- Standard, where you manage node pools and node configuration
- Autopilot, where Google manages the nodes and you pay per Pod resource request
Choose GKE:
- when you already have Kubernetes investment
- when you need fine-grained workload scheduling (taints, tolerations, node affinities, custom DaemonSets)
- when you run mixed batch and serving workloads
- when you operate stateful sets that need PersistentVolumeClaim semantics across pods
Cloud Run is the request-driven managed container surface.
You push a container to Artifact Registry, run gcloud run deploy, and Cloud Run accepts HTTPS traffic and scales replicas from zero to a configured maximum based on concurrent requests.
Cloud Run jobs run the same container as a run-to-completion task, triggered manually, by Cloud Scheduler, or by Eventarc.
Cloud Run worker pools host always-on background workers that consume from a queue without serving HTTP.
Cloud Run fits stateless web services, background workers that scale on queue depth, and short-lived batch jobs that fit inside the per-execution timeout.
Cloud Run functions (the renamed Cloud Functions surface) is a layer of opinionation on top of Cloud Run. You write a single function entry point in Node.js, Python, Go, Java, .NET, Ruby, or PHP; Google builds the container for you and deploys it to a Cloud Run service. The gen 2 runtime executes on Cloud Run internally, so request concurrency, instance lifetimes, and scaling shape match Cloud Run services.
Cloud Run functions fits event handlers (Pub/Sub messages, Eventarc events, HTTP webhooks) where the code is small enough that the build step belongs to the platform rather than your CI pipeline.
Comparison
A compact decision framing helps in the exam room.
- If the workload is a long-running stateful process that requires kernel-level access or non-container runtime, choose Compute Engine.
- If you already operate Kubernetes or need granular scheduling, choose GKE (Autopilot when you can express the workload in pod requests, Standard when you need node-level control).
- If the workload is a stateless HTTP service that can scale to zero and tolerates cold starts, choose Cloud Run services.
- If the workload is a small event handler whose container build belongs to the platform, choose Cloud Run functions.
- If the workload is a finite batch task, choose Cloud Run jobs.
Decision flow across the compute surfaces
Beyond the abstraction-level decision, three operational factors push the answer one way or the other.
- Cold-start tolerance: Cloud Run services scale to zero with a sub-second to multi-second cold-start penalty depending on container size, while GKE keeps pods warm at the cost of paying for idle capacity.
- Concurrency model: Cloud Run charges per request and bills CPU only during request handling unless you opt into always-allocated CPU, while GKE bills for the node regardless of utilization.
- Identity model: Cloud Run services and Cloud Run functions attach a single service account per service, while GKE supports per-Pod identity via Workload Identity Federation, useful when one cluster runs services with different blast radiuses.
💡 Exam Trap: Knative serving and Cloud Run for Anthos are not new product surfaces. They are the open-source API layer that Cloud Run uses internally and the Anthos-hosted deployment of the same. A question that asks "which surface should host a Knative-compatible workload" usually answers to Cloud Run (managed) when portability across clouds is not required, and to Cloud Run for Anthos on a GKE Enterprise cluster when the workload must run on customer-managed Kubernetes.
💡 Exam Trap: Cloud Run services do not autoscale to zero when minimum instances is set above zero. A question that names a "latency-critical Cloud Run service with no cold starts" must set
--min-instancesto at least 1; that flag in turn produces a continuous billing line for the reserved CPU and memory.
Installing and configuring the command line interface for Kubernetes (kubectl)
kubectl is the canonical client for any Kubernetes cluster, including GKE.
The Google Cloud SDK ships a bundled distribution: gcloud components install kubectl.
On managed package systems you can also install the component via sudo apt-get install kubectl after adding the Google Cloud package repository, or via Homebrew with brew install kubectl.
The version of kubectl should be within one minor release of the cluster control plane; mismatches beyond that window produce API errors when calling resources that the client does not know about.
Authenticating kubectl against a GKE cluster goes through gcloud container clusters get-credentials.
The command writes a kubeconfig entry under ~/.kube/config that points at the cluster API endpoint and uses the Google Cloud authentication plugin for credentials:
# Install kubectl and the GKE auth plugin
gcloud components install kubectl gke-gcloud-auth-plugin
# Bind kubectl to a GKE cluster
gcloud container clusters get-credentials prod-gke \
--region europe-west4 \
--project svc-app-prod
# Confirm the active context and namespace
kubectl config current-context
kubectl get nodes
The gke-gcloud-auth-plugin component is required for the authentication path. Without it, kubectl against any newly created cluster fails with error: no Auth Provider found for name "gcp". The --region flag selects regional clusters; --zone selects zonal clusters. The credentials write happens client-side; nothing on the cluster changes.
📊 Limit: GKE supports
kubectlclients within one minor version below or above the control plane. A 1.30 control plane accepts 1.29, 1.30, and 1.31 clients; a 1.28 client against a 1.30 control plane produces deprecation warnings on resources whose schema moved.
Loading data into Google Cloud
A second piece of compute planning is moving the dataset that the workload needs into Google Cloud. Three paths cover the spectrum from one-off uploads to recurring transfers. The first path is command-line upload from a workstation.
- The canonical tool is
gcloud storage cp. - The legacy tool is
gsutil cp(still supported, slower on large files because it lacks the parallel composite upload defaults of the newer client).
Both speak Cloud Storage natively:
# Single file
gcloud storage cp ./bigtable-export.csv gs://lake-ace/raw/bigtable-export.csv
# Recursive directory
gcloud storage cp --recursive ./snapshots gs://lake-ace/raw/snapshots
# Resumable upload of a 50 GB file with parallel composite parts
gcloud storage cp ./fact-table.parquet gs://lake-ace/raw/fact-table.parquet \
--content-type application/octet-stream
The second path is loading from Cloud Storage into the destination service. BigQuery, Cloud SQL, Spanner, and AlloyDB each accept Cloud Storage URIs as the source.
BigQuery's bq load reads CSV, JSON, Avro, ORC, and Parquet directly from gs://. Cloud SQL for MySQL and PostgreSQL accepts SQL dumps from gs:// via gcloud sql import.
This pattern avoids running the load through your workstation and keeps the source data in a backed-up bucket for reproducibility.
The third path is Storage Transfer Service, the managed transfer engine. It moves data into Cloud Storage from Amazon S3, Microsoft Azure Blob Storage, HTTP/HTTPS endpoints, on-premises POSIX filesystems via a transfer agent, and other Cloud Storage buckets.
Transfers can be one-time or scheduled; they restart from the last checkpoint after a transient failure; and they support filtering by object prefix, modification time, and file size. Storage Transfer Service is the right answer for any recurring or large cross-cloud copy: a one-off aws s3 cp works for a handful of files, but Storage Transfer Service handles checkpointing, parallelism, and notification fanouts that hand-rolled scripts get wrong at scale.
📊 Limit: Storage Transfer Service can move billions of files in a single job, with concurrency tuned automatically per source. The legacy 1 TB filesystem-source transfer threshold no longer applies; the constraint is bucket and project quota rather than a per-job ceiling.
⚠️ Anti-Pattern: Writing a Compute Engine VM that runs a cron job to
aws s3 cpfrom S3 into a Cloud Storage bucket every night. Storage Transfer Service handles the same workload without a babysit-the-VM rotation, retries from checkpoint on failure, and emits Pub/Sub notifications on completion. Use the managed service.
🎯 Scenario: A team migrates a public dataset from an S3 bucket to Cloud Storage so a Dataflow job can process it daily. The dataset is 12 TB across 4 million objects. The right path is a scheduled Storage Transfer Service job sourcing the S3 bucket, targeting a Standard-class regional Cloud Storage bucket in the same region as the Dataflow job, with daily incremental transfers triggered by Cloud Scheduler. A hand-rolled
gsutil rsyncfrom a Compute Engine VM is the wrong answer: it would saturate the VM's network, lack retry-from-checkpoint semantics on a 12 TB run, and produce no audit trail.
Decision Anchor: Choose Compute Engine when the workload requires kernel-level access, GPU drivers outside the supported Cloud Run set, or persistent host filesystem semantics. Choose GKE when you already operate Kubernetes or need granular pod scheduling.
Choose Cloud Run services for stateless HTTP that tolerates scale-to-zero. Choose Cloud Run functions when the unit of work is a single handler and you want the platform to build the container. Choose Cloud Run jobs for finite batch. ---
