Enforcing Production Deployment Gates with Binary Authorization and Cloud KMS
Short answer
D Sign the attestation with a key stored in Cloud KMS and add a GKE cluster-specific rule in Binary Authorization for the production project policy.
Question
Key Takeaways
Binary Authorization enforces deployment policies by requiring signed attestations for container images. Signing keys must be stored in Cloud KMS for security, and policies must be configured in the production project to block unauthorized deployments.
Expert Analysis
You want only container images that have passed certain automated UAT tests to be deployed to the production environment. You have already created an attestor. What should you do next?
The scenario requires enforcing a strict deployment policy in Google Kubernetes Engine (GKE) using Binary Authorization, specifically gating production deployments on the successful completion of User Acceptance Testing (UAT) executed via Cloud Build. The core mechanism for this enforcement is the attestation workflow: a trusted party or service must sign an attestation stating that the image passed specific criteria, and the cluster's admission controller must reject any image lacking this valid signature.
Option D is the correct approach because it aligns with both security best practices and the logical flow of the CI/CD pipeline. First, the attestation key must be stored in Cloud Key Management Service (KMS). Using KMS is mandatory for production-grade Binary Authorization setups because it provides centralized control over cryptographic keys, enables audit logging of key usage via Cloud Audit Logs, and supports key rotation without disrupting services. Storing keys as Kubernetes secrets (as suggested in Options A and B) is insecure and operationally unmanageable for production environments; Kubernetes secrets are not designed for high-assurance signing operations and lack the necessary lifecycle management features required for compliance.
Second, the Binary Authorization policy rule must be applied to the production Google Cloud project. The goal is to restrict production deployments. Therefore, the admission controller logic resides in the production project’s Binary Authorization configuration. While GKE clusters can have cluster-specific overrides, the primary enforcement point for the policy described—ensuring only UAT-passed images reach production—is the project-level default or specific policy rule. Option C suggests adding a rule to the UAT project, which would incorrectly allow or deny images based on UAT standards within the UAT environment itself, failing to enforce the gate at the destination (production). Furthermore, Option C uses KMS correctly but fails on the scope.
Options A and B are incorrect primarily due to the use of Kubernetes secrets for signing. Even if we overlook the security implication, Option A applies the rule to the UAT project, which does not control production traffic. Option B applies the rule to the production project, which is the correct scope, but the insecure key storage makes it invalid.
Option C is incorrect because it targets the UAT project policy. The question asks how to ensure images passing UAT are deployed to production. Enforcing the policy in the UAT project would affect deployments to UAT, not production. The production cluster needs to verify the attestation before accepting the pod spec.
Additionally, there is a subtle but critical detail regarding the "Attestor." An Attestor in Binary Authorization is a resource that defines who can sign attestations. Once the Attestor is created, the Cloud Build step responsible for UAT must be authorized to sign attestations using a key associated with that Attestor. The signing action happens after the tests pass. The resulting signed attestation is then attached to the container image metadata. When the GKE admission controller receives a request to deploy that image in production, it checks the Binary Authorization policy. If the policy requires an attestation from the specific Attestor created earlier, and the image has a valid signature from a key trusted by that Attestor, the deployment proceeds. If the signature is missing or invalid, the deployment is blocked. Thus, storing the signing key in KMS ensures the integrity of the signing process, and applying the policy in the production project ensures the gate is active where it matters most.
Exam Strategy
When configuring Binary Authorization, always associate signing keys with Cloud KMS rather than Kubernetes secrets or local files to ensure auditability and secure key management. Identify the target environment for your policy constraint; if the requirement is to protect production, the Binary Authorization policy rule must reside in the production project, not the source or testing project. Remember that the Attestor defines the trust anchor, while the policy defines the enforcement point.
Related Analysis
Practice All PCD Questions
Access 84 questions with complete answers and detailed explanations.
View Full PCD Practice Test →