Fix GCP GKE Binauthz Errors
When working with GCP GKE, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with binauthz and shows the exact fix.
A Common Mistake
Not enabling Binary Authorization, allowing unverified or vulnerable container images to be deployed to the cluster.
The incorrect command:
gcloud container clusters create my-cluster --region=us-central1 --no-enable-binauthz
Error output:
Cluster created without Binary Authorization.
A developer deploys an image with critical CVEs:
kubectl run vuln-app --image=gcr.io/my-project/vulnerable-image@sha256:xxx
The image contains known vulnerabilities (CVSS 9.8) but deploys successfully. Attackers exploit the vulnerability.
The Correct Approach
The right way to configure binauthz in GCP GKE:
gcloud container clusters create my-cluster --region=us-central1 --enable-binauthz --binauthz-evaluation-mode=PROJECT_SINGLETON_POLICY_ENFORCE
Successful result:
Cluster created with Binary Authorization.
gcloud container binauthz policy export > policy.yaml
# Set policy to require attestations
kubectl run vuln-app --image=gcr.io/my-project/vulnerable-image
Error: admission webhook "binaryauthorization.googleapis.com" denied the request: Image does not have a valid attestation.
How to Prevent This
Enable Binary Authorization for production clusters. Integrate with Container Analysis and Artifact Analysis. Use attestations from CI/CD pipelines to verify images. Create admission allowlist for approved base images. Monitor admission requests with Cloud Audit Logs. BinAuthz integrates with Google Cloud Deploy.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro