Prepare and test your skills

Prepare and test your skills

Remotely connecting to a Compute Engine instance means using Secure Shell (SSH) for Linux virtual machines (VMs) and Remote Desktop Protocol (RDP) for Windows VMs through allowed network paths. Linux access depends on how SSH keys are stored and checked, while Windows access depends on credentials, firewall rules, and whether traffic goes over the internet or a private path. Identity-Aware Proxy (IAP) TCP forwarding lets both SSH and RDP reach VMs without public IP addresses.
SSH key management for Linux VMs uses either metadata-based keys or OS Login (opens in a new tab) for centralized control. Metadata-based keys are public keys stored in project metadata, which grants access to all VMs in the project, or instance metadata, which grants access to that VM only, with root privileges by default. OS Login stores keys in the user's OS Login profile tied to a Google identity and checks Identity and Access Management (IAM) permission on every login, so removing roles/compute.osLogin or roles/compute.osAdminLogin or suspending the user blocks the next login.
The two models differ in where keys live and when access is checked. Metadata keys are checked once at upload and stay valid until removed, so suspending a user does not remove keys already in metadata. OS Login-enabled VMs fetch keys from the OS Login service and ignore metadata keys, and they provision a consistent Linux identity with username, user ID, group ID, and home directory. OS Login is controlled by the enable-oslogin metadata key, where instance-level FALSE overrides project-level TRUE, so an organization policy is needed to enforce it consistently.
Exam tip: Instance-level enable-oslogin=FALSE disables OS Login even when project metadata sets it to TRUE; OS Login-enabled VMs ignore metadata-based SSH keys.
VPC firewall rules for remote administration allow ingress TCP traffic to port 22 for SSH and port 3389 for RDP from a trusted source. Traffic flows from the client to the IAP proxy and then from the IAP proxy to the primary internal address of nic0 on the target VM, so the VM needs no external IP address. The secure pattern allows ingress only from the IAP source range 35.235.240.0/20, while the default rules default-allow-ssh and default-allow-rdp allow the same ports from all addresses.
IAP adds Google authentication, IAM authorization such as IAP-secured Tunnel User, optional context-aware access, and audit logging of connection attempts before traffic reaches the VM. The SSH session stays end-to-end encrypted between client and VM, so IAP cannot inspect session contents and does not record sessions. If session recording is required, traffic flows from the client through IAP to a bastion VM that terminates SSH, and then from the bastion VM to target VMs that allow SSH only from that bastion.
RDP access opens the graphical desktop of a Windows instance when traffic flows from an RDP client to the instance over TCP port 3389. The instance depends on a VPC firewall rule that allows that port and on a Windows username and password created from the instance details page. The Google Cloud console shows the external IP for internet access and the internal IP for private access, and the same addresses can be listed with gcloud compute instances list.
Three paths differ in public IP need and network route. Direct RDP with the Microsoft client uses the external IP over the internet or the internal IP over Cloud VPN or Cloud Interconnect. IAP Desktop sends traffic from the local app through IAP to the private address, so no public IP is needed when the firewall allows IAP traffic. Chrome Remote Desktop (opens in a new tab) sends the session from a browser through the host service linked to a Google Account, so no public IP is needed after the host service, Windows credentials, PIN, and display device are set up.
Continue with this study guide: Remotely connecting to a Compute Engine instance
Viewing current running Compute Engine (opens in a new tab) instances means listing all VMs in a project and checking their zone, status, machine type, and network addresses. Operators use the gcloud command line for fast discovery and the Google Cloud console plus Cloud Monitoring for visual health checks. Each network interface of an instance is attached to a subnet of a Virtual Private Cloud (VPC) network, which separates the internal address used inside the VPC from the external address used from the internet.
Command-line discovery uses gcloud compute instances list to show all VMs in the current project as a human-readable table. The default table includes name, zone, status, machine type, and internal and external IP addresses, so the operator can confirm what is running and find names for deeper checks. Traffic flows from the Compute Engine API to the gcloud client and then to the formatted table.
| Command | Scope | Output |
|---|---|---|
gcloud compute instances list | All VMs in a project | Table of key fields, customizable with --format and --filter |
gcloud compute instances describe VM_NAME | One named VM | Complete details for that VM, YAML by default with json, yaml, or text options |
The list command depends on knowing the project, while the describe command depends on knowing the instance name from the list. The --format flag selects fields and shapes such as table, json, or yaml, while --filter returns only matching VMs, --limit caps results, and --sort-by orders them. Choose list for discovery across many VMs and describe only after the exact name is known.
Console monitoring starts on the VM instances page, which lists running instances in the selected project after billing and the Compute Engine and Cloud Monitoring APIs are enabled. Each row shows zone, operating system, and machine type, and clicking a name opens details where the Observability tab shows CPU, memory, network throughput, and logs for that VM. The Observability tab depends on Cloud Monitoring, and charts may take a few minutes to appear after creation.
Project-wide health is viewed on the Dashboards page, where Cloud Monitoring automatically installs dashboards for VM instances and their disks. The GCE VM Instance Monitoring dashboard compares all VMs in the project, while the VM Instances view focuses on one VM and its logs. Automatically created Google Services dashboards cannot be modified or deleted directly, so the operator must use Copy dashboard or Save as dashboard and then edit the copy with Add widget, repositioning, and Save.
Continue with this study guide: Viewing current running Compute Engine instances
Working with snapshots and schedules (opens in a new tab) in Compute Engine means backing up Persistent Disk data with snapshots and reusing configured disks with custom machine images. A Persistent Disk is durable network storage independent of its VM, while a snapshot is a point-in-time backup that is incremental after the first full capture. A custom image is an immutable copy of a configured boot disk used to start many identical VMs.
Manual snapshot creation stores only changed blocks from the source zonal or regional Persistent Disk to the snapshot, with support for compression and encryption. Data flows from the source disk to the snapshot during backup, and later from the snapshot to a new disk created during restore. Restoring never overwrites the source disk and never deletes the source snapshot, so one snapshot can create many disks.
Verification means listing snapshots by project, location, or source disk before relying on them. Standard snapshots are global by default and can create disks in any region, while regional snapshots keep data and metadata co-located to control cost and exposure. Deleting a snapshot never deletes disks already created from it, which allows safe cleanup of old backups.
A snapshot schedule is a resource policy that automatically creates standard snapshots of Persistent Disk or Hyperdisk volumes on a regular interval. The schedule must be created in the same region as the disk, for example a disk in us-west1-a needs a schedule in us-west1, but the snapshots it produces can be stored in a different location. The schedule can be created first and attached to existing disks, or a new disk can be created with the schedule already attached.
Frequency controls how much change is unprotected, while retention controls how long snapshots are kept before automatic deletion. A retention policy is required in the console and gcloud CLI, while REST can omit it to keep snapshots indefinitely. If the disk uses a customer-managed encryption key (CMEK), scheduled snapshots use the same key, while disks with customer-supplied keys (CSEK) cannot use schedules.
| Snapshot type | Created by schedules | Deleted when source disk is deleted |
|---|---|---|
| Standard snapshots | Yes | No, survives and supports recycle bin recovery |
| Archive snapshots | No | No, but deletion is irreversible |
| Instant snapshots | No | Yes, local backup exists only with source disk |
A custom image captures a configured source disk, snapshot, or another image as a reusable boot reference stored via Cloud Storage and registered in Compute Engine. Data flows from the source disk to the image resource, and then from the image to boot disks of new VMs in any region. The disk must contain a partition table and at least one bootable partition, and creation requires image and VM permissions in the owning project.
Reliable capture requires stopping writes during copy. Stopping the VM is most consistent, while a running VM requires pausing writers, stopping writes, and running sudo sync to flush the filesystem. An image family groups successive versions under one constant name, so new VMs that reference the family receive the newest non-deprecated image without changing templates or scripts.
Exam tip: Reference the image family name to launch from the newest version automatically; reference a specific image name only when a fixed version is required.
Viewing current running GKE cluster inventory means identifying the correct scope and then listing nodes, Pods, and Services to check system integrity. A fleet is the top boundary that groups clusters across projects, managed from a fleet host project by the Fleet service. Below the fleet are individual clusters, and within a fleet are team scopes that partition clusters by application team.
Fleet scope lets an operator observe many clusters from one place, such as twenty clusters across ten projects, instead of switching projects. GKE clusters on Google Cloud must be explicitly registered during or after creation, while Google Distributed Cloud and GKE on AWS and Azure register automatically at creation and cannot be unregistered. Clusters outside Google Cloud depend on the Connect Agent, where traffic flows from the agent on the cluster to Google Cloud through NATs, proxies, or VPNs without exposing the Kubernetes API server.
Membership location controls where fleet inventory is managed, with global management as the default and regional management for data-residency needs. A cluster must be unregistered and registered again to change membership location. Team scopes sit between fleet-wide and single-cluster views, so operators can find objects by team and apply access control, observability, and upgrade sequencing consistently across linked clusters.
Command-line inspection uses kubectl to query the live cluster control plane for current state and events. Traffic flows from kubectl on the workstation to the GKE control plane, and the control plane returns only resources the user is authorized to see. Connection requires installing kubectl, running gcloud container clusters get-credentials CLUSTER_NAME --location=LOCATION, and verifying permission with kubectl auth can-i get nodes.
| Resource | Inspection command | Healthy state |
|---|---|---|
| Nodes | kubectl get nodes | Ready |
| Pods | kubectl get pods --all-namespaces | Running |
The kubectl get command lists inventory for overall availability, while kubectl describe shows metadata, configuration, status conditions, and recent events for one object. Use get first to find unhealthy resources, then use describe to connect a Pod to its node or a Service to its configuration. Any status other than Ready for nodes or Running for Pods requires investigation.
Console inventory moves from fleet distribution to cluster detail without typing commands. The Google Kubernetes Engine (opens in a new tab) dashboard lists clusters in the project, and selecting a cluster opens detail sections such as Networking. A GKE cluster consists of at least one control plane plus worker nodes, which are Compute Engine VMs that run Kubernetes processes and host Pods.
External conformant clusters appear alongside native clusters through GKE attached clusters. An AttachedCluster resource is created as a regional resource in the Google project, and the Connect Agent in the external cluster creates a secure tunnel back to Google Cloud. That tunnel lets the console manage Amazon EKS and Azure AKS clusters with fleet tools such as Policy Controller, Config Sync, Cloud Service Mesh, and Connect Gateway.
Configuring GKE to access Artifact Registry (opens in a new tab) means storing container images in a Docker repository and letting cluster nodes pull them by full image URI. Artifact Registry repositories are separate storage locations tied to one regional or multi-regional location, and the repository must already exist before pushing or pulling to the pkg.dev domain. GKE Pods pull the image listed in spec.containers[].image, while Deployments list the same image under spec.template.spec.containers.
A Docker repository is created with gcloud artifacts repositories create using --repository-format=docker and --location, with optional description, encryption, immutable tags, and scanning. The image URI format is LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE:TAG, for example us-west1-docker.pkg.dev/my-project/my-repo/test-image:staging. If no :TAG is given, Docker pulls the latest tag.
Tagging and pushing moves data from the local Docker client to the repository in order. First the client authenticates to the repository location, then docker tag applies the full destination URI to the local image, then docker push uploads the layers. Manifests are applied with kubectl apply -f YAML_FILE_NAME, after which the kubelet on each node pulls the listed image from the resolved location, project, and repository.
Node-level access lets the Compute Engine instances that act as GKE nodes pull same-project images with their attached Google Cloud service account. Traffic flows from the kubelet on the node to Artifact Registry, which checks the node identity's IAM permission. This path is simple but broad because every Pod on the same node pool shares the node identity.
| Access method | Identity used | Best when |
|---|---|---|
| Node-level access | Node's Google Cloud service account | Cluster and registry share a project and share permission |
| Workload Identity Federation for GKE | Linked Kubernetes and IAM service accounts | Different workloads need least-privilege permissions |
| Kubernetes imagePullSecret | Stored credential referenced by Pod | Registry is cross-project without federation or external |
Workload Identity Federation links a namespace-scoped Kubernetes service account to an IAM service account, so traffic flows from the Pod to Google Cloud APIs under the linked identity. The IAM account is granted roles/artifactregistry.reader in the project that owns the repository, even when the cluster is in a different project. An imagePullSecret is instead referenced by the Pod and sent by the kubelet with the pull, which suits specific namespaces or registries that cannot trust node IAM identity.
Exam tip: Use automatic node credentials for same-project pulls, but use a Kubernetes imagePullSecret or a federated IAM grant when the cluster and the Artifact Registry repository are in different projects.
Continue with this study guide: Configuring GKE to access Artifact Registry
Working with GKE node pools (opens in a new tab) means creating, modifying, and deleting groups of nodes that supply cluster compute capacity. A node pool is a set of Compute Engine VMs with the same machine type, disk configuration, and pricing model, and Pods are scheduled onto those nodes. In Standard mode the project pays for node resources regardless of Pod requests, so pool size and type directly affect cost and reliability.
Creating a node pool defines capacity matched to a workload, including whether nodes use lower-cost Spot VMs or stable standard VMs. A resilient design mixes both so batch work uses Spot capacity while critical work keeps standard capacity when Spot VMs are unavailable. Node auto-provisioning can create Spot pools automatically when Pods request them, adding the cloud.google.com/gke-spot=true:NoSchedule taint so only tolerating Pods run there.
Deleting a pool removes its nodes and the capacity where its Pods ran, so workloads must move first by updating tolerations, nodeSelector, or affinity. Spot reclamation is involuntary, deletes local SSD data, may change IP addresses after recreation, and is not limited by PodDisruptionBudgets. Stateful work on Spot VMs should terminate gracefully within 25 seconds to reduce corruption risk.
| VM type | Availability | Best use |
|---|---|---|
| Spot VMs | No guarantee, can be reclaimed at any time | Fault-tolerant batch jobs and stateless apps |
| Standard VMs | Stable capacity | Critical, stateful, and baseline workloads |
The cluster autoscaler resizes each Standard node pool between a configured minimum and maximum based on Pod resource requests, not live utilization. It adds nodes when Pods are unschedulable and removes underutilized nodes when all Pods could fit on fewer nodes. New nodes are created in parallel through the pool's Managed Instance Group (MIG), and explicit resource requests are required for correct decisions.
Limits can be set per zone with --min-nodes and --max-nodes or for the whole pool with --total-min-nodes and --total-max-nodes, where the two modes are mutually exclusive. While autoscaling is enabled, the pool cannot be manually resized; the operator must disable autoscaling, resize, and re-enable it. Compute Engine autoscaling must not be enabled on the same MIGs because the two controllers conflict.
Exam tip: The cluster autoscaler scales on Pod resource requests, not on live utilization, so missing or too-small requests prevent correct scale-up.
Placement uses Kubernetes node labels to attract Pods and node taints to repel them. A workload with a selector matching label1=value1 runs only on labeled nodes, while a tainted node accepts only Pods with a matching toleration. Both settings can be updated with gcloud container node-pools update --node-labels or --node-taints without recreating the pool, but each update overwrites prior values so all retained entries must be repeated.
Migration follows cordon, then drain, then rescheduling by controllers. Cordoning marks nodes unschedulable for new Pods, draining evicts existing Pods gracefully within spec.terminationGracePeriodSeconds defaulting to 30 seconds, and Deployments, StatefulSets, Jobs, or DaemonSets recreate the Pods on remaining nodes. Standalone Pods are not rescheduled and can block drain, and a LoadBalancer Service with externalTrafficPolicy: Local may need to change to Cluster before cordoning.
Working with Kubernetes resources in GKE (opens in a new tab) means deploying containers as Pods, exposing them with Services, and choosing controllers that match whether data must survive restarts. Nodes are Compute Engine VMs grouped into a cluster, while the Google-managed control plane runs the API server. Pods are temporary by nature because they can be created, moved, or replaced during scaling or updates.
A Kubernetes Service is a networking abstraction that provides a stable IP address and discovery mechanism on top of changing Pods. Pods have no stable addresses because placement across nodes is dynamic, so the Service stays fixed while Pods and nodes change. Different Service types such as ClusterIP, NodePort, and LoadBalancer support internal discovery and external routing.
Traffic flows from clients to the load balancer frontend, then through routing and load balancing rules, and then to the backends. The frontend defines the boundary: an external Application Load Balancer listens on the public internet near clients, while an internal Application Load Balancer listens inside the VPC network. The GKE Ingress controller and GKE Service controller watch Ingress and Service objects and create plus manage load balancers, IP addresses, firewall rules, and backend lists as endpoints change.
Stateful applications must save data beyond Pod lifetime because files inside containers are lost on restart. A PersistentVolume (PV) is cluster storage that exists independently of Pods, typically backed by a Compute Engine persistent disk or NFS through Filestore. A PersistentVolumeClaim (PVC) requests a specific size, access mode, and StorageClass, and Kubernetes binds the claim to a matching volume or dynamically provisions one.
StatefulSets are the controller for workloads that need per-Pod persistence and stable network identity through rescheduling, updates, and scaling. Simple file storage uses a PersistentVolume mounted into the Pod, while database state uses either a managed service such as Cloud SQL or Spanner for lower operations work or a database running inside Kubernetes for more control. Choose a StatefulSet when each replica must keep its own data and identity.
Exam tip: A PersistentVolume continues to exist after its Pod is deleted, while a PersistentVolumeClaim is the request that specifies size, access mode, and StorageClass.
A Deployment is the controller for stateless applications where Pods are uniform and interchangeable. The Deployment maintains desired state for replica count, container image version from a registry such as Artifact Registry, and Pod labels. Changing the specification causes GKE to move running Pods toward the new desired state, which supports scaling and rolling updates.
Stateless design works because data stays with the client rather than on the cluster, so a lost Pod can be replaced identically. A frontend with multiple replicas is a common example because replicas increase availability and scale down when demand falls. Containers in the same Pod can share volumes to survive container restarts, but data that must survive Pod replacement still needs persistent storage or an external database.
Managing Pod autoscaling in GKE means changing Pod count with Horizontal Pod Autoscaler (HPA) and changing Pod size with Vertical Pod Autoscaling (VPA). HPA adds or removes replicas based on demand, while VPA adjusts CPU and memory requests for containers. Both depend on accurate resource requests and interact with the cluster autoscaler that adds or removes nodes.
Horizontal Pod Autoscaler (HPA) (opens in a new tab) is a per-workload controller attached to a Deployment or similar workload that keeps replica count between minReplicas and maxReplicas. Each HPA loop checks its workload's metrics against targets, adding replicas when use is above target and removing them when use stays below target. The HPA definition can use CPU or memory use, custom Kubernetes metrics such as requests per second, or external metrics such as Pub/Sub queue size.
Percentage-based CPU or memory targets are calculated as a percentage of each Pod's requests, so every container must define a request for that resource. HPA objects are created from YAML with autoscaling/v2 recommended for memory, custom, external, and multiple metrics, while autoscaling/v1 supports only CPU. Data flows from workload metrics to the HPA controller, and the HPA controller then adds or removes Pods before node capacity changes.
Vertical Pod Autoscaling (VPA) observes historical CPU and memory use and recommends or applies correct requests through a recommender and controller. VPA suits long-running homogeneous workloads where too-small requests cause throttling or out-of-memory failures and too-large requests waste node capacity and cost. VPA is enabled by default in Autopilot and must be enabled in Standard, and it requires a workload controller because standalone Pods cannot be recreated with new sizes.
| Mode | What VPA does | Impact on Pod lifecycle |
|---|---|---|
| Off | Calculates recommendations only | No disruption, manual review |
| Initial | Assigns requests only at Pod creation | Disruption only at creation |
| Auto | Evicts and recreates Pods to apply requests | Causes Pod re-creation |
The best practice starts in Off for at least 24 hours and ideally a week before using Initial or Auto. Recommendations can be bounded with minAllowed and maxAllowed, limited to CPU or memory, or disabled for a sidecar. Manual sizing should set memory request equal to memory limit and CPU request to the minimum needed with an unbounded CPU limit.
HPA and VPA must not target the same CPU or memory metric on the same workload because both controllers would react differently to the same signal. The safe pattern separates duties: HPA changes replica count from request rate, queue size, or CPU percentage, while VPA changes Pod size. Accurate requests link Pod scaling to node scaling because the cluster autoscaler decides from requests, not actual utilization.
When HPA creates unschedulable Pods, traffic flows from those Pods to a scale-up decision by the cluster autoscaler, which adds nodes in parallel up to pool or cluster maximums. The cluster autoscaler removes underutilized nodes down to the minimum but never removes a node holding unmovable Pods. Compute Engine autoscaling must stay disabled on GKE node MIGs to avoid conflicting with the GKE cluster autoscaler.
Exam tip: The cluster autoscaler scales on Pod resource requests, not actual resource utilization, so missing or too-small requests prevent correct scale-up and scale-down.
Continue with this study guide: Managing horizontal and vertical Pod autoscaling configurations
Managing GKE Autopilot (opens in a new tab) Pod resource requests means declaring CPU, memory, and ephemeral storage so Autopilot can provision nodes, schedule Pods, and bill correctly. Autopilot creates and removes nodes automatically without manual node pools, and it provisions capacity from the sum of Pod requests. Billing charges for requested CPU, memory, and accelerators even when containers use less.
Resource requests drive both placement and cost because the scheduler places a Pod only where requests fit and billing charges for those reservations. Over-requesting increases cost without improving performance, while under-requesting risks throttling, eviction, or out-of-memory restarts. Specialized hardware follows the same model, with exactly one GPU Pod per GPU node plus system workloads and tolerant DaemonSets.
Scaling flows from pending Pods to node changes based on requests rather than real-time use. Unschedulable Pods trigger parallel node creation until they can become active, and underutilized nodes are removed when all Pods could fit on fewer nodes. Each new node takes about 80 to 120 seconds to boot before pending Pods can be placed, so low-priority placeholder Pods are sometimes used to hold warm capacity until higher-priority Pods preempt them.
Exam tip: Autopilot scales and bills on what Pods request, not what containers actually use — accurate requests control both cost and scheduling.
Autopilot modifies workload configuration at creation to meet minimums, maximums, and ratios. Missing requests receive defaults for the compute class, requests below minimums are raised such as below 0.05 vCPU to 50 mCPU, and the smaller of CPU or memory is scaled to meet the minimum 1 vCPU to 1 GiB ratio. Ephemeral storage is raised to the per-container minimum, while excess storage is rejected in version 1.28.6-gke.1317000 and later.
Requests and limits together set Quality of Service and bursting. When limits equal requests, the Pod receives Guaranteed QoS and stays at its reservation, while higher or unset CPU and memory limits allow Burstable QoS to use spare node capacity opportunistically. Ephemeral storage limits must always equal requests, and extra capacity added for minimums goes to the first container unless the autopilot.gke.io/primary-container annotation names another container. Under memory pressure, GKE throttles CPU but terminates containers to reclaim memory, so memory should cover normal use plus boot.
Continue with this study guide: Managing GKE Autopilot Pod resource requests
Deploying new versions of a Cloud Run (opens in a new tab) application means creating immutable revisions and controlling which revision receives traffic. A Cloud Run service receives all traffic at its main URL, and its traffic configuration maps percentages to serving revisions that must total 100. A revision is a snapshot of container images plus settings such as environment variables, memory, CPU, concurrency, networking, security, and scaling.
Any deployment or configuration change creates a new revision, even when the container image does not change. Revisions can be deployed from the console, gcloud CLI, or YAML that updates spec.template attributes, and an image tag is resolved to a digest so the revision always serves that digest. Existing revisions can never be edited, and a custom suffix can be supplied with --revision-suffix.
Revisions that receive no requests consume no resources and are not billed, except minimum instances can keep capacity reserved. Cloud Run supports up to 1000 revisions per service and removes unused revisions over time. Container images are imported at deploy time and kept while used by a serving revision, so new instances do not pull again from the repository.
Traffic allocation routes each new request from the service URL to listed revisions by percentage, while in-flight requests run to completion during transitions. A canary rollout deploys the new revision with 0% traffic by using no-traffic options, then shifts weight in steps such as 5% to 25% to 50% to 100% while checking performance. A blue-green or multi-revision split keeps versions side by side, for example 25%, 25%, and 50%, where increasing one revision requires decreasing others.
| Strategy | Traffic allocation | Choose when |
|---|---|---|
| Gradual rollout | New revision grows from 0% to small percent to 100% | New version needs real-user validation |
| Split traffic | Two or more revisions share traffic | Versions must run side by side |
| Rollback | Previous revision returns to 100% | Faulty version must be replaced fast |
| Serve latest | Latest healthy revision takes 100% | Single-version operation should resume |
A rollback sends 100% back to a previous healthy revision with gcloud run services update-traffic SERVICE --to-revisions REVISION=100, while --to-latest clears pinning so new revisions serve 100% automatically. A split persists for future deployments until explicitly cleared, so a service pinned to an older revision will not automatically serve the newest revision.
A revision tag is a lowercase name such as green that creates a separate test URL like https://green---myservice-abcdef.a.run.app without giving the revision production traffic. The tagged revision is deployed with --no-traffic --tag TAG_NAME, so testers reach that URL while production users stay on serving revisions. The safe sequence runs integration tests, tests in staging with no traffic, tests the tagged revision in production, and only then migrates production percentages over hours or days.
Cleanup avoids extra cost and clutter because tagged revisions with revision-level minimum instances keep running. Tags should be removed when testing ends, and a 0% revision can be deleted even with a tag, after which Cloud Run tries to remove the tag from traffic configuration. Service-level minimums do not allocate extra capacity to tagged revisions, which helps control billing during testing.
Exam tip: Traffic percentages must total 100, and a split stays in effect for later deployments until you explicitly send all traffic to the latest revision.
Continue with this study guide: Deploying new versions of a Cloud Run application
Adjusting application traffic splitting means dividing requests that arrive at a service URL across two or more versions by percentage. Traffic flows from the generic service URL to the splitter, the splitter routes each request to one version, and that version returns the response. URLs that explicitly target a version bypass the split, so testing and production traffic can coexist while both versions stay available.
App Engine services support splitting by sender IP address or by HTTP cookie, selected in the console Versions page with Split traffic, with gcloud app services set-traffic, or with the Admin API. IP splitting hashes the sender IP to 0–999 and routes by that value, while cookie splitting uses the GOOGAPPUID cookie value from 0–999 and creates the cookie when missing. For apps created after February 2020, REGION_ID.r appears in service URLs that distribute traffic to default or named services.
| Method | How routing value is assigned | Precision and stickiness |
|---|---|---|
| IP address splitting | Splitter hashes sender IP to 0–999 | Approximate and less sticky, varies most at low traffic |
| Cookie splitting | Splitter uses GOOGAPPUID 0–999 across 1000 shards | Precise near 0.1% and sticky, same cookie stays on same version |
Choose IP splitting when simplicity matters and approximate distribution is acceptable for external browser traffic. Choose cookie splitting for A/B testing, gradual rollouts, and internal app-to-app traffic, because internal requests share few infrastructure IPs that can all land on one version. Mobile and desktop clients must store and resend cookies, while browsers handle them automatically.
Exam tip: Use cookie splitting, not IP splitting, for internal app-to-app requests, because internal requests come from a small pool of IP addresses that can all land on one version and ignore the intended percentages.
Caching risk grows during splits because two versions can reference different static resources behind the same service URL. A client may receive a page from version B but load a cached CSS file from version A that is incompatible. For dynamic resources the app sets both Cache-Control and Expires, while for cacheable static resources the app changes the resource URL between versions so both copies coexist. Vary: Cookie separates cache entries by cookie but can create up to 1000 entries per URL for GOOGAPPUID alone, lowering hit rates.
Rollback reallocates 100% of service traffic to a single stable version without redeploying code, so traffic flows directly from the service URL to that version. Disabling a split the same way returns the service to single-version serving until a new split is configured. In Google Distributed Cloud air-gapped, pod egress is separately controlled: the Platform Administrator must disable data exfiltration protection and the Application Operator must add egress.networking.gke.io/enabled: true to the pod template before traffic can leave the organization.
Configuring autoscaling for a Cloud Run (opens in a new tab) application means setting concurrency, CPU allocation, and instance limits so the service adds instances under load and scales to zero when idle. Concurrency sets simultaneous requests per instance, CPU allocation decides whether CPU exists only during requests, and minimum and maximum instances bound warm capacity and total scale-out. The autoscaler adds instances before requests queue and removes idle instances to save cost.
Request concurrency is the maximum simultaneous requests one instance processes, defaulting to 80 per instance. Incoming requests flow from the load balancer to instances until that limit nears, and the autoscaler by default targets about 60% CPU utilization and about 60% of maximum concurrency, or about 48 concurrent requests at the default. Lower concurrency scales out faster with more cost, while higher concurrency packs more work onto fewer instances with possible latency risk.
| Allocation model | When CPU is allocated | Choose when |
|---|---|---|
| Request-based billing | CPU flows only while at least one request is processed | Work happens only during requests and scale-to-zero is desired |
| Instance-based billing | CPU flows for full instance life including idle time | Background work runs between requests or minimum instances stay warm |
An idle instance processes no requests and, unless minimum instances keep it warm, is not kept longer than 15 minutes. Request-based billing throttles CPU to zero when idle, so background threads require instance-based billing. CPU limits default to 2 vCPU with paired memory, and instances can burst above a 6.25% baseline per vCPU using accrued burst balance for short spikes.
Minimum instances keep warm containers ready even with no traffic, so traffic flows directly to a ready instance without a cold start. The default minimum is 0 for scale-to-zero, where a new request must start an instance after arriving. Maximum instances cap parallel instances per revision with a default of 100, which controls cost and protects dependencies such as databases with limited connections.
When demand exceeds the maximum, requests wait in a pending queue for up to 3.5 times average startup time or 10 seconds, whichever is greater, then fail with 429 if no instance frees. Service-level and revision-level limits combine with fixed rules: the highest minimum wins except a revision maximum strictly caps a service minimum, and maximum always caps minimum. Traffic splits and deployments can briefly push total service instances above a per-revision maximum, visible in the Cloud Monitoring Instance Count metric.
Exam tip: Scaling from zero requires an incoming request, and scaling to zero requires that no instance is processing a request — CPU falling to low levels alone does not trigger scale-to-zero.
Continue with this study guide: Configuring autoscaling for a Cloud Run application
35.235.240.0/20 for IAP TCP forwarding, which reaches the internal address of nic0 without an external IP.kubectl get nodes reports Ready and a Pod is healthy only when kubectl get pods reports Running.OS Login stores SSH keys in the users OS Login profile tied to a Google identity and checks Identity and Access Management permission on every login, while metadata-based SSH keys are stored in project or instance metadata and stay valid until removed after a single check at upload. OS Login-enabled virtual machines ignore metadata-based keys, and an instance-level enable-oslogin value of FALSE disables OS Login even when project metadata sets it to TRUE.
Traffic flows from the client to the IAP proxy and then to the primary internal address of nic0 on the target virtual machine, so the virtual machine needs no external IP address. The secure pattern allows ingress TCP traffic to port 22 for SSH and port 3389 for RDP only from 35.235.240.0/20, while the default-allow-ssh and default-allow-rdp rules allow the same ports from all addresses.
Use cookie splitting for A/B testing, gradual rollouts, and internal app-to-app traffic because internal requests come from a small pool of infrastructure IP addresses that can all land on one version and ignore the intended percentages. IP address splitting hashes the sender IP to 0 to 999 and is approximate and less sticky, while cookie splitting uses the GOOGAPPUID cookie value from 0 to 999 and is precise near 0.1 percent and sticky so the same cookie stays on the same version.
Any deployment or configuration change creates a new immutable revision that cannot be edited, and traffic allocation routes each new request from the service URL to listed revisions by percentage where percentages must total 100. A split persists for future deployments until explicitly cleared, so a service pinned to an older revision will not automatically serve the newest revision until traffic is sent to the latest revision.
Last updated