Implement GCP Binary Authorization to enforce deploy-time security controls that ensure only trusted, attested container images are deployed to Google Kubernetes Engine and Cloud Run.
Implement GCP Binary Authorization to enforce deploy-time security controls that ensure only trusted, attested container images are deployed to Google Kubernetes Engine and Cloud Run.
Binary Authorization is a Google Cloud deploy-time security control that ensures only trusted container images are deployed on GKE or Cloud Run. It works through a policy-based model where images must have cryptographic attestations confirming they passed predefined requirements such as vulnerability scans, code reviews, or build pipeline verification. Continuous validation (CV) monitors running pods against policies and logs violations.
When to Use
When deploying or configuring implementing gcp binary authorization capabilities in your environment
When establishing security controls aligned to compliance requirements
When building or improving security architecture for this domain
When conducting security assessments that require this implementation
Common Misconfigurations & Verification
Policy in dry-run / audit-only: an enforcementMode: DRYRUN_AUDIT_LOG_ONLY logs violations but deploys unattested images anyway. For real enforcement it must be ENFORCED_BLOCK_AND_AUDIT_LOG. Grep the exported policy for both enforcementMode and evaluationMode.
evaluationMode: ALWAYS_ALLOW: this admits every image regardless of attestation, defeating the control. Production rules need REQUIRE_ATTESTATION (or ALWAYS_DENY as default).
Overly broad whitelist patterns:admissionWhitelistPatterns like gcr.io/** or * bypass attestation entirely — keep them scoped to Google system images only.
Binauthz not enabled on the cluster: the policy is org-wide but the cluster admits anything unless created/updated with --enable-binauthz.
Break-glass without alerting: the break-glass: "true" label skips enforcement; without a log-based alert on it, it becomes a silent bypass.
gcloud container binauthz policy export | grep -E 'enforcementMode|evaluationMode|namePattern'
gcloud container clusters describe CLUSTER --zone ZONE \
--format='value(binaryAuthorization.evaluationMode)'# not DISABLED# Negative test: an unattested image must be denied
kubectl run binauthz-test --image=docker.io/library/nginx:latest
kubectl get events --field-selector reason=FailedCreate
# This should be blocked
kubectl run test-unapproved \
--image=docker.io/library/nginx:latest
# Verify the pod was denied
kubectl get events --field-selector reason=FailedCreate
Verify attestation exists
gcloud container binauthz attestations list \
--attestor=prod-build-attestor \
--attestor-project=PROJECT_ID
Break-Glass Override
For emergency deployments bypassing Binary Authorization: