Skip to main content

Infrastructure Orchestration

Docs: Infrastructure as Code on Google Cloud

Infrastructure as Code (IaC)​

Terraform​

The standard IaC tool for GCP. Defines infrastructure in HCL (HashiCorp Configuration Language); manages resource lifecycle (create, update, destroy) via a state file.

  • terraform plan β€” preview changes before applying
  • terraform apply β€” create or update resources to match config
  • terraform destroy β€” tear down all managed resources
  • Remote state β€” store state in a Cloud Storage bucket for team collaboration and locking

Google provides the Google Cloud Terraform provider and a library of pre-built modules (VPC, GKE, Cloud SQL) via the Cloud Foundation Toolkit.

Use when: Managing long-lived infrastructure (VPCs, clusters, databases) that needs version control, code review, and repeatable deployments.

Docs: Terraform on Google Cloud

Config Connector​

A Kubernetes operator that lets you manage GCP resources using Kubernetes-style YAML manifests. GCP resources (Cloud SQL, Pub/Sub, BigQuery) are represented as Kubernetes custom resources, and Config Connector reconciles them with the real GCP state.

Use when: Your team is already GKE-native and wants to manage GCP resource dependencies (e.g. a database that a Kubernetes workload depends on) in the same GitOps workflow as application manifests.

Docs: Config Connector overview

Terraform vs. Config Connector​

TerraformConfig Connector
Config formatHCL (.tf files)Kubernetes YAML (CRDs)
ScopeAny GCP resource, multi-cloud, non-GKE infraGCP services managed via Kubernetes YAML alongside app workloads
Drift detectionOn next plan (manual or scheduled)Continuous β€” controller reconciles on any drift

Use Terraform when:

  • Managing infrastructure outside of or independent from GKE (VPCs, Cloud SQL, IAM, multi-cloud)
  • Your team works in a classic CI/CD pipeline and doesn't have a running GKE cluster
  • You need multi-environment promotion with explicit plan/apply gates

Use Config Connector when:

  • You want to manage GCP services (Cloud SQL, IAM, Pub/Sub, BigQuery, etc.) using the same Kubernetes YAML and kubectl workflow as your application workloads β€” one language, one tool, one pipeline
  • You want a single GitOps workflow (kubectl apply) for both app and infra
  • Continuous drift reconciliation is more important than explicit plan previews

Docs: Choosing between Terraform and Config Connector


Compute Engine Provisioning Primitives​

Instance Templates​

A reusable specification for a VM β€” machine type, boot disk image, network, labels, startup script. Used as the basis for Managed Instance Groups.

  • Changes to a template do not automatically update existing VMs β€” you must update the MIG or roll out a new template version.

Docs: Instance templates

Managed Instance Groups (MIGs)​

A group of identical VMs created from an instance template. Managed Instance Groups provide:

FeatureDetail
AutoscalingScale in/out based on CPU, load balancer utilisation, Pub/Sub queue depth, or custom metrics
AutohealingHealth checks detect unhealthy VMs and automatically recreate them
Rolling updatesUpdate VM template gradually with configurable max surge and max unavailable
Multi-zoneSpread VMs across zones in a region for HA
Stateful MIGsPreserve disk and network interface across VM restarts β€” for stateful workloads

Unmanaged Instance Groups β€” a flat group of VMs you manage individually; used to attach heterogeneous VMs to a load balancer. No autoscaling or autohealing.

Docs: Managed instance groups


Patch Management and OS Configuration​

VM Manager (OS Config)​

Google's managed service for OS-level configuration and patching across Compute Engine VMs.

  • Patch management β€” define patch jobs that apply OS updates across a fleet of VMs on a schedule
  • OS inventory β€” view installed packages and versions across all VMs from a central dashboard
  • OS policies β€” enforce desired state configuration (install a package, write a file, run a script) using OS Config agents

Use when: The exam mentions fleet-level patch compliance, OS vulnerability management, or consistent configuration across many VMs without managing a separate configuration management tool.

Docs: VM Manager overview


Container Orchestration Patterns​

GKE Workload Provisioning​

Beyond cluster creation, key provisioning concepts for GKE:

  • Node pools β€” groups of nodes with the same machine type/config within a cluster; different workloads run on different node pools (e.g. CPU pool for web, GPU pool for ML)
  • Cluster autoscaler β€” adds/removes nodes based on pending pod demand
  • Horizontal Pod Autoscaler (HPA) β€” scales pod replicas based on CPU/memory or custom metrics
  • Vertical Pod Autoscaler (VPA) β€” adjusts CPU/memory requests for pods based on actual usage
  • PodDisruptionBudgets β€” guarantee minimum available replicas during node drain or rolling updates

Serverless Compute Provisioning​

  • Cloud Run β€” no provisioning; specify min/max instances and concurrency. Use min instances > 0 to avoid cold starts.
  • Cloud Run Functions β€” configure memory (128MB–32GB), timeout, and concurrency. 2nd gen functions run on Cloud Run under the hood.

Exam Tips​

  • "Self-service provisioning with guardrails" β†’ Terraform modules with approved templates + Org Policy constraints
  • "Manage GCP resources alongside Kubernetes workloads in GitOps" β†’ Config Connector
  • "Auto-replace unhealthy VMs" β†’ MIG with autohealing (health check + recreate action)
  • "Patch all VMs in the org on a schedule" β†’ VM Manager patch jobs
  • "Scale based on Pub/Sub queue depth" β†’ MIG autoscaling with custom metric (Pub/Sub subscription/num_undelivered_messages)

Official Documentation​