Compute Engine deployment basics
Compute Engine gives you full control over VMs. You choose machine type, boot disk image, network, and startup scripts. Use instance templates to define a reusable VM config, then instance groups to deploy at scale.
- Managed Instance Groups (MIGs) support autoscaling, autohealing (via health checks), rolling updates, and load balancing across zones.
- Unmanaged instance groups let you group dissimilar VMs but cannot autoscale or autoheal — rarely the right exam answer.
- Preemptible VMs run up to 24 hours max and can be reclaimed anytime with 30 seconds notice; Spot VMs are the newer version with no fixed 24-hour cap. Both are much cheaper but unsuitable for stateful, uninterruptible workloads.
- Startup scripts (via metadata key startup-script) run on every boot — handy for bootstrapping without baking custom images.
GKE (Google Kubernetes Engine)
GKE runs containerised workloads on managed Kubernetes clusters.
- Two cluster modes: Standard (you manage node config, full control) and Autopilot (Google manages nodes, you pay per pod resource — recommended default for new clusters since it's hands-off and cost-efficient).
- Node pools group nodes with the same config; you can have multiple pools in one cluster for different workload needs (eg GPU pool vs standard pool).
- Cluster autoscaler adjusts node count; Horizontal Pod Autoscaler (HPA) adjusts pod replica count based on CPU/metrics — know the difference, they're commonly confused.
- Deployments manage stateless pods with rolling updates; StatefulSets are for stateful workloads needing stable identity/storage.
- Use gcloud container clusters create for cluster creation and kubectl for workload management once you have credentials via gcloud container clusters get-credentials.
App Engine
App Engine is a fully managed, serverless platform for deploying application code without managing servers.
- Standard environment: sandboxed, fast autoscaling (including scale-to-zero), supports specific language runtimes, cheaper for spiky/light traffic.
- Flexible environment: runs in Docker containers on Compute Engine VMs, supports any language/custom runtime, no scale-to-zero, slower scaling, higher baseline cost.
- Deploy with gcloud app deploy, using app.yaml to configure the service, scaling type, and runtime.
- Traffic splitting lets you route percentages of traffic between versions for gradual rollouts or A/B testing — a favourite exam scenario.
Common exam traps
- Don't pick Compute Engine when the question hints at 'no infrastructure management' — that's App Engine or Cloud Run territory.
- Don't confuse regional vs zonal MIGs: regional MIGs spread instances across zones for higher availability.
- Remember preemptible/Spot VMs are unsuitable for anything needing guaranteed uptime or long single-session jobs.
- Autopilot GKE removes node management entirely — pick it whenever the scenario says 'minimise operational overhead' for Kubernetes.
What is the maximum runtime for a preemptible VM?
24 hours, after which it is automatically terminated.
tap to reveal
How much warning does a preemptible or Spot VM get before reclamation?
30 seconds.
tap to reveal
What is the key difference between preemptible and Spot VMs?
Spot VMs have no fixed 24-hour runtime limit; preemptible VMs do.
tap to reveal
What can a Managed Instance Group do that an unmanaged one cannot?
Autoscale, autoheal via health checks, and perform rolling updates.
tap to reveal
What is a regional MIG and why use one?
A MIG that spreads instances across multiple zones in a region, for higher availability than a zonal MIG.
tap to reveal
What does GKE Autopilot mode manage for you compared to Standard mode?
It fully manages node infrastructure; you only manage workloads and pay per pod resource.
tap to reveal
What is the difference between HPA and Cluster Autoscaler in GKE?
HPA scales the number of pod replicas; Cluster Autoscaler scales the number of nodes in the cluster.
tap to reveal
When would you use a StatefulSet instead of a Deployment in GKE?
When pods need stable network identity and persistent storage, ie for stateful workloads.
tap to reveal
What are the two App Engine environments and their key trade-off?
Standard (sandboxed, fast scale-to-zero, limited runtimes) and Flexible (Docker on Compute Engine VMs, any runtime, no scale-to-zero).
tap to reveal
What file configures an App Engine service's runtime and scaling?
app.yaml.
tap to reveal
What command deploys an App Engine application?
gcloud app deploy
tap to reveal
What GKE feature lets you route a percentage of traffic to a new App Engine version?
Traffic splitting.
tap to reveal
What metadata key runs a script on every Compute Engine VM boot?
startup-script
tap to reveal
What command fetches credentials so kubectl can manage a GKE cluster?
gcloud container clusters get-credentials
tap to reveal
Why would 'minimise operational overhead' in a Kubernetes exam scenario point to a specific GKE mode?
It points to GKE Autopilot, since Google manages node infrastructure entirely.
tap to reveal