Cloud Build private pool and Binary Authorization for GKE

PCD By islever Editorial Last updated

Short answer

B Use a Cloud Build private worker pool to keep source and build artifacts inside your controlled VPC, and enforce Binary Authorization at GKE admission so only images attested by your pipeline can deploy.

Question

You are developing a container build pipeline for an application hosted on GKE. You have the following requirements: • Only images that are created using your build pipeline should be deployed on your GKE cluster. • All code and build artifacts should remain within your environment and protected from data exfiltration. How should you build the pipeline?
    1. Create a build pipeline by using Cloud Build with the default worker pool.
    1. Create a build pipeline by using Cloud Build with a private worker pool.
    Correct Answer
    1. Create a build pipeline by using Cloud Build with a private worker pool.
    1. Create a build pipeline by using Cloud Build with the default worker pool.

Key Takeaways

A secure GKE container pipeline combines a Cloud Build private worker pool with Binary Authorization. The private pool keeps source and build artifacts inside the controlled VPC, while Binary Authorization rejects any image lacking a trusted pipeline attestation at admission. That combination makes option B correct; default pools, vulnerability scanning, IAM, and Container Analysis each satisfy only part of the requirement.

Expert Analysis

B. Binary Authorization ensures only images signed by trusted authorities are deployed to GKE, enforced at deploy time. Vulnerability scanning (A) detects but doesn't prevent. IAM (C) controls who can deploy.

The pipeline has two independent guarantees to satisfy: provenance (only images produced by this pipeline) and isolation (code and build artifacts do not leave the controlled environment). A private Cloud Build worker pool is the only build-side choice that addresses the second; Binary Authorization at GKE admission addresses the first. Options A and D both use the default worker pool, so they fail isolation regardless of any scanning they add. Options C and D fail provenance because neither IAM nor Container Analysis can require that an image originated from the pipeline.

Build isolation

Cloud Build's default worker pool is a shared, Google-managed execution environment. Build steps and their network egress are not placed in a VPC network that you control, which conflicts with a requirement that all code and build artifacts remain within your environment and be protected from exfiltration. A private worker pool runs build workers in a VPC network and project under your control; you can remove external IP addresses from the workers, use Private Google Access or Cloud NAT for required Google APIs, and keep pushed images in your project's Artifact Registry. That is the build-side behavior option B selects, while option A's default pool and option D's default pool leave the build traffic on the managed pool.

Admission control

The second requirement cannot be met by private networking alone: a private build keeps the pipeline's code inside the perimeter, but it does not stop an authorized user or another process from pushing a different image to the registry and deploying it. Binary Authorization is a GKE admission-time control that evaluates a policy and admits only images that carry a trusted signature or attestation. When the build pipeline signs or attests the image it produces, the GKE policy can require that attestation, so an image that did not come through the pipeline is rejected at deployment. IAM, the control associated with option C, governs who may call Kubernetes or Artifact Registry APIs; it does not encode image provenance, and any principal with deploy rights could still deploy an image built elsewhere. Container Analysis, associated with option D, and the vulnerability scanning in option A produce scan findings and metadata; they do not deny an unsigned image at admission.

The attestation mechanism

The mechanism that ties these controls together is the attestation: after a successful build, the pipeline creates a signed attestation that records the image digest and the builder identity, and Binary Authorization verifies that attestation against the GKE policy when the Pod is created. Using this question's entities, the private pool keeps the source and build artifacts in the controlled VPC and Artifact Registry, while the attestation makes "created by this pipeline" an enforceable property of the image digest rather than an assumption based on registry permissions. A default-pool build might still produce a signed image, but it has already failed the isolation constraint; a private-pool build with only IAM has no admission check binding the digest to the pipeline.

Therefore B is the only option that covers both constraints with the appropriate services. Scanning options detect but do not prevent; IAM controls identities but not image origin; and default worker pools do not satisfy the requirement that code and artifacts remain in the controlled environment.

Official Reference

Exam Strategy

Split the stem into its independent constraints and eliminate any option that satisfies only one. Here, isolation of code and artifacts rules out the default worker pool, and provenance of the deployed image rules out scanning-only and IAM-only designs; scanning detects, IAM authorizes identities, but neither binds an image digest to the build pipeline. On PCD questions about supply chain, look for the pair of private build execution plus admission control rather than the single control with the most familiar name.

Practice All PCD Questions

Access 84 questions with complete answers and detailed explanations.

View Full PCD Practice Test →

← Back to PCD Study Guide