Prepare and test your skills

Prepare and test your skills

Resource Efficiency and Operational Overhead describes how much hardware an application needs and how much manual work it takes to keep it running. Containers improve both measures by packaging applications in a lighter way than virtual machines and by letting managed platforms handle scaling, patching, and infrastructure. The result is higher use of each host machine, faster startup, and lower cost and maintenance work.
Containers use fewer resources than virtual machines (VMs) because a container holds only the application and its dependencies without including a full operating system. A VM carries its own complete operating system, so each VM needs considerably more compute and memory even before the application runs. Because containers share the host operating system kernel instead of booting their own, many containers can run on the same host while behaving consistently across environments. This shared-kernel model is what lets Google Kubernetes Engine (GKE) (opens in a new tab) pack many workloads onto fewer machines.
Density and utilization explain how containers get more work from the same hardware. Containers allow fine-grained resource allocations, so teams can pack multiple containers or Pods onto the same VMs and leave hardware idle less often. Containers are typically fast to start, which supports scalable and resilient apps that must grow, shrink, or restart quickly. Fast startup plus high density means fewer extra VMs must be over-provisioned for peaks.
The following comparison summarizes the resource difference:
| Option | What runs on each instance | Resource and cost effect |
|---|---|---|
| Traditional VMs on Compute Engine (opens in a new tab) | Each VM includes a full operating system plus the application | Heavier footprint, more compute and memory per workload, costs continue even when idle |
| Containers on managed platforms | Each container includes app code and dependencies and shares the host operating system | Lighter footprint, greater workload density per host, fast startup that supports scaling and resilience |
Managed container services reduce operational overhead by shifting infrastructure work from the team to Google Cloud. GKE offers automatic operating system upgrades with a security-optimized node kernel, which frees teams from maintaining host operating systems themselves. Managing containers declaratively with Kubernetes also streamlines infrastructure work compared with managing each VM individually.
When workloads move to services such as GKE, Cloud Run (opens in a new tab), and Batch, Google Cloud handles the underlying VMs, patching, and scaling:
Exam tip: VMs incur costs even when idle, while managed container services can be more cost-effective for fluctuating or low traffic because they scale with demand.
Agility through microservices and scalability is the ability to break a large application into smaller parts that can be updated and scaled on their own. Containers make this possible because each container packages an application and all of its dependencies into a lightweight, consistent unit. When those containers run on orchestration platforms, teams can deploy faster and scale only the parts that need more capacity.
The move from monolith to microservices replaces a single, tightly coupled application with a set of focused, independently deployable services. A legacy monolith is typically built as one large codebase, hosted on servers the team must manage, and difficult to upgrade because any change requires redeploying the whole application. A container is a lightweight package that holds an application and its dependencies, so the same container runs more consistently in development, testing, and production. Kubernetes (opens in a new tab) provides management, resilience, and monitoring building blocks such as Pods, Services, Deployments, and replica sets, where a microservice is commonly a Deployment with a set of load-balanced Pods behind a Service.
Related tools such as Istio and Knative add traffic management, security policy, and serverless deployment patterns without requiring a rewrite of the application. Migrate to Containers (opens in a new tab) can extract an application from a VM into a container image without requiring access to source code, so teams gain orchestration benefits before they break the monolith apart. The overall flow moves from the VM-based monolith to container images, then to orchestrated microservices managed as Deployments and Services.
Independent scaling means each microservice grows or shrinks based on its own traffic, rather than scaling the entire application together. Google Kubernetes Engine (GKE) (opens in a new tab) runs many containers on shared VMs by packing multiple Pods onto the same nodes, which increases workload density and can reduce the number of VMs needed. Kubernetes then watches demand and health for each Deployment, while GKE adds cluster autoscaling, auto-repairing, auto-upgrading, regional clusters, and highly available control planes. Cloud Run (opens in a new tab) provides a serverless container option that removes cluster management and scales automatically, including scaling down to zero during inactivity.
The choice between GKE and Cloud Run depends on protocol, lifetime, and control needs:
| Option | Best for | Scaling and management |
|---|---|---|
| Cloud Run | Stateless HTTP(S) microservices with variable traffic | Autoscaled per request down to zero, no cluster to manage, billed per request duration |
| Google Kubernetes Engine (GKE) | Many containers with different requirements, long-running processes, queue listeners, or TCP/UDP and proprietary protocols | Pod autoscaling plus cluster autoscaling, fine-grained control over Deployments and Services, nodes charged per cluster |
Kubernetes orchestration keeps scaled services healthy without manual intervention:
Because scaling applies per Deployment or per Cloud Run service, a busy checkout service can add Pods while an idle reporting service stays small.
Exam tip: Choose Cloud Run for HTTP microservices that can scale to zero, and choose GKE when the workload needs non-HTTP protocols, long-running processes, or fine-grained Kubernetes control.
Accelerated deployment cycles mean code changes move from commit to production in minutes through repeatable, automated steps. Modern image-based management treats the container image as an immutable artifact that flows from source code to registry to each environment. Cloud Build (opens in a new tab) builds the image, runs the test suite against it, and, if tests pass, stores the result in Artifact Registry with a repeatable tag such as semantic versioning or a Git commit hash. Cloud Deploy then promotes that same tested artifact through environments in order, first to development, then to quality assurance, and only after validation to production.
Configuration files and secrets are injected at deploy time, so the image itself does not change between environments and the risk of production-only errors drops. This pipeline also enables advanced strategies such as rolling updates, canary releases, and blue/green deployments, where traffic shifts gradually from the old revision to the new revision. For any given artifact, each automated deployment process executes the following tasks in order:
Extending test coverage, monitoring, and security controls such as binary authorization and image vulnerability scanning makes each cycle faster and safer over time.
Environmental consistency means an application behaves the same way in development, testing, and production because it carries its runtime environment with it. Portability means that same packaged application can move between environments and Google Cloud runtimes without being rebuilt for each one. Containers provide both by packaging an application and its dependencies into a container image that can run on Google Kubernetes Engine (GKE), GKE Autopilot, GKE Enterprise, or Cloud Run (opens in a new tab). Migrate to Containers (opens in a new tab) can containerize existing VM-based applications for these runtimes without requiring source code access, rewriting, or rearchitecting.
A container is a lightweight package that contains an application and all its dependencies. Unlike a virtual machine (VM), a container does not include a full operating system, so it uses fewer compute and memory resources and many containers can run on the same host. A container image is the built artifact that holds the application, its runtime, and its dependencies, while environment-specific configuration files and secrets are injected when the image is deployed. This separation keeps the image immutable, meaning the same tested artifact can be used in different environments.
Teams can build a controlled set of base container images and then build workload images from them. Keeping base images tightly controlled and supported prevents unsupported runtime environments from spreading. Tests should cover the image itself, not only the application inside it, so the runtime environment is validated too. Compliance test suites, such as those run with InSpec, can check the runtime environment for required settings and files.
Promoting one image across environments is the practice of building a container image once and moving that same image through development, testing, quality assurance, and production. Rebuilding an image at each stage can introduce small differences between code branches, which may cause production failures or add untested code to a production image. Artifact Registry (opens in a new tab) stores container images, Cloud Build can build images, run tests, and store successful results, and Cloud Deploy can implement the deployment process. Because the same artifact passes through multiple validation activities, the chance of production issues drops.
A flow diagram showing one immutable container image being built by Cloud Build, stored in Artifact Registry, and promoted through development, testing, and production, with configuration and secrets injected at deploy time.
The promotion sequence runs in a fixed order:
This sequence uses the same image across environments, while environment-specific settings change only at deployment time.
Exam tip: Build the container image once and promote that same image through development, testing, and production; inject environment-specific configuration and secrets at deployment instead of rebuilding the image.
Portability across Google Cloud container runtimes comes from using industry-standard Open Container Initiative (OCI) images, sometimes called Docker images. OCI-compliant images can run on container runtimes such as GKE, GKE Autopilot, GKE Enterprise, and Cloud Run. Cloud Foundry droplets are not directly compatible with the OCI specification, so migrating from Cloud Foundry to Cloud Run requires changing the build process to produce OCI images.
Three strategies can produce OCI images:
| Strategy | How it creates OCI images | Tradeoff |
|---|---|---|
| Lift and shift | Dockerize Cloud Foundry build components | Least refactoring and repeatable, but the pipeline is self-managed and older components need ongoing security maintenance |
| Cloud Native Buildpacks (CNB) (opens in a new tab) | Builders follow the CNB specification | Maintainers handle maintenance; rebasing supports fast security updates; portable OCI images; possible v2 and v3 buildpack gaps |
| Self-managed Dockerfiles | Author Dockerfiles for each application | Most flexibility, but per-app configuration, harder standardization, and patching requires a full rebuild and redeploy |
Resource-constrained teams may first use lift and shift to modify Cloud Foundry, then move to CNB or self-managed Dockerfiles. Teams ready to migrate immediately should try CNB and then use self-managed Dockerfiles if they need a high level of control over the environment.
Windows containers (opens in a new tab) let .NET Framework applications gain container benefits such as agility, portability, and control without migrating to .NET. However, not all of the Windows stack is supported, and the right operating system target depends on the .NET Framework version. Linux containers are more lightweight than Windows containers and run on more platforms more efficiently. Because .NET is multi-platform, a .NET application can be containerized into a Linux container, which creates more deployment options and removes dependency on Windows licensing costs.
Container orchestration tools such as Kubernetes and GKE manage containers declaratively, so the desired state of applications and clusters is described in configuration. GKE provides automatic operating system upgrades, health checks, automated rollouts and rollbacks, autoscaling Pods, cluster autoscaling, regional clusters, and highly available control planes. These features help keep the same container image running consistently across environments and allow updates to be applied in a controlled way.
Security controls help ensure that only trusted images move between environments. Artifact Analysis can scan container images stored in Artifact Registry for vulnerabilities, and Binary Authorization can allow only a set of signed images to be deployed in clusters. A deterministic build process with specific software and library versions prevents unverified code from entering the container. Running containers as a non-root user and including only necessary components reduce risk. These practices support portability because an image that passes security checks in one environment can be trusted in another.
Containers use fewer resources than virtual machines (VMs) because a container holds only the application and its dependencies without including a full operating system, while each virtual machine carries its own complete operating system. Because containers share the host operating system kernel instead of booting their own, many containers can run on the same host and Google Kubernetes Engine (GKE) can pack many workloads onto fewer machines.
Cloud Run is best for stateless HTTP(S) microservices with variable traffic because it autoscales per request down to zero with no cluster to manage and is billed per request duration. Google Kubernetes Engine (GKE) is best for many containers with different requirements, long-running processes, queue listeners, or TCP/UDP and proprietary protocols because it provides Pod autoscaling plus cluster autoscaling with fine-grained control over Deployments and Services.
The same container image should be promoted through development, testing, quality assurance, and production because rebuilding an image at each stage can introduce small differences that may cause production failures or add untested code. Environment-specific configuration files and secrets are injected at deployment time, so the image stays immutable and the same tested artifact is validated in each environment.
Managed services such as Google Kubernetes Engine (GKE), Cloud Run, and Batch reduce overhead because Google Cloud handles the underlying virtual machines (VMs), patching, and scaling. Resources adjust based on demand and can scale down for fluctuating or low traffic, which improves utilization and is more cost-effective than paying for idle virtual machines (VMs) while freeing staff time.
A development team frequently encounters situations where an application functions properly on local developer workstations but fails when deployed to staging and production servers due to mismatched library versions and environment configurations.
How does containerization resolve this issue across different deployment environments?
Last updated