Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En este documento, se explica cómo habilitar el modo de ejecución de prueba.
Cuando habilitas el modo de ejecución de prueba, la autorización binaria permite que se implementen todas las imágenes de contenedor, incluso si esas imágenes infringen la política de autorización binaria. Los mensajes de estado de cumplimiento de políticas se registran en Registros de auditoría de Cloud.
Puedes inspeccionar el registro para determinar si las imágenes se hubieran inhabilitado y tomar las medidas correctivas. Cuando la configuración de la política funciona según lo previsto, puedes inhabilitar el modo de ejecución de prueba para habilitar la aplicación de la autorización binaria. No se pueden implementar las imágenes que infringen la política.
Puedes configurar el modo de ejecución de prueba en la regla predeterminada o en una específica.
Para probar el modo de ejecución de prueba, implementa imágenes que infrinjan la política y, luego, visualiza los eventos del modo de ejecución de prueba de Autorización Binaria para GKE, Cloud Run o Google Distributed Cloud.
Inhabilita el modo de ejecución de prueba
Para inhabilitar el modo de ejecución de prueba, actualiza tu política de la siguiente manera:
Console
Ve a la página Autorización binaria en la consola de Google Cloud.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eDry-run mode in Binary Authorization allows all container images to be deployed, regardless of policy violations, with policy compliance status logged in Cloud Audit Logs.\u003c/p\u003e\n"],["\u003cp\u003eEnabling dry-run mode can be done either through the Google Cloud console or via the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, by modifying the Binary Authorization policy settings.\u003c/p\u003e\n"],["\u003cp\u003eYou can test dry-run mode by deploying images that violate the policy and then viewing the logged events for GKE, Cloud Run, or Google Distributed Cloud.\u003c/p\u003e\n"],["\u003cp\u003eDry-run mode can be disabled by updating the Binary Authorization policy in the Google Cloud console or through the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, switching to enforced mode that blocks and logs violations.\u003c/p\u003e\n"]]],[],null,["# Enable dry-run mode\n\n| **Note:** This document or section includes references to one or more terms that Google considers disrespectful or offensive. The terms are used because they are keywords in the software that's described in the document. \n| The terms: `whitelist`\n\nThis document explains how to enable dry-run mode.\n\nWhen you enable dry-run mode, Binary Authorization allows all container images to be\ndeployed, even if those images violate the Binary Authorization policy. Policy\ncompliance status messages are logged to [Cloud Audit Logs](/logging/docs/audit).\nYou can inspect the log to determine whether the images would have been\ndisallowed and take corrective action. When the policy configuration works as\nyou intend, you can disable dry-run mode to enable Binary Authorization enforcement;\nimages that violate the policy are disallowed from being deployed.\n\nYou can set dry-run mode in the default rule or a specific rule.\n\nBefore you begin\n----------------\n\nTo use dry-run mode, [set up Binary Authorization for your platform](/binary-authorization/docs/set-up-platform).\n\nEnable dry run\n--------------\n\n| **Caution:** Enabling dry run in your default admission rule, as shown, allows all container images to be deployed, even if they violate the deployment policy.\n\nTo enable dry run, do the following: \n\n### Console\n\n1. Go to the Binary Authorization page in the Google Cloud console.\n\n [Go to Binary Authorization](https://console.cloud.google.com/security/binary-authorization/).\n2. Click **Edit Policy**.\n\n3. In **Default Rule** or a specific rule, select **Dry-run mode**.\n\n | **Note:** To demonstrate dry-run mode, you can also set the rule to **Disallow all images**. With this setting, all images violate the policy, are disallowed from being deployed, and the violations are logged.\n4. Click **Save Policy**.\n\n### gcloud\n\n1. Export the Binary Authorization policy to a YAML file:\n\n gcloud container binauthz policy export \u003e /tmp/policy.yaml\n\n2. In a text editor, set `enforcementMode` to `DRYRUN_AUDIT_LOG_ONLY` and\n save the file.\n\n | **Note:** To demonstrate dry-run mode, you can set `evaluationMode` to `ALWAYS_DENY`. With this setting, all images violate the policy, are disallowed from being deployed, and the violations are logged.\n3. To update the policy, import the file by executing the following command:\n\n gcloud container binauthz policy import /tmp/policy.yaml\n\n| **Note:** It can take a few minutes for the policy to take effect.\n\nTo test dry-run mode, deploy images that violate the policy and then view\ndry-run mode events from Binary Authorization for [GKE](/binary-authorization/docs/viewing-audit-logs#dry_run_events),\n[Cloud Run](/binary-authorization/docs/run/viewing-audit-logs-cloud-run#query_for_dry_run_events),\nor [Google Distributed Cloud](/binary-authorization/docs/viewing-on-prem-logs#view_dry_run_log_entries).\n\n### Disable dry-run mode\n\nTo disable dry-run mode, update your policy as follows: \n\n### Console\n\n1. Go to the Binary Authorization page in the Google Cloud console.\n\n [Go to Binary Authorization](https://console.cloud.google.com/security/binary-authorization/)\n2. Click **Edit Policy**.\n\n3. In **Default Rule** or a specific rule, clear **Dry-run mode**.\n\n4. Click **Save Policy**.\n\n### gcloud\n\n1. Export the Binary Authorization policy:\n\n gcloud container binauthz policy export \u003e /tmp/policy.yaml\n\n2. In a text editor, set `enforcementMode` to\n `ENFORCED_BLOCK_AND_AUDIT_LOG` and save the file.\n\n3. To update the policy, import the file by executing the following\n command:\n\n gcloud container binauthz policy import /tmp/policy.yaml\n\n| **Note:** It can take a few minutes for the policy to take effect.\n\nWhat's next\n-----------\n\n- View dry-run mode events from Binary Authorization for [GKE](/binary-authorization/docs/viewing-audit-logs#dry_run_events) in Cloud Audit Logs.\n- View dry-run mode events from Binary Authorization for [Cloud Run](/binary-authorization/docs/run/viewing-audit-logs-cloud-run#query_for_dry_run_events) in Cloud Audit Logs.\n- View dry-run mode events from Binary Authorization for [Distributed Cloud](/binary-authorization/docs/viewing-on-prem-logs#view_dry_run_log_entries) in Cloud Audit Logs."]]