Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara mengonfigurasi namespace yang dikecualikan di Pengontrol Kebijakan.
Namespace yang dikecualikan menghapus namespace dari penerapan webhook penerimaan dengan
Pengontrol Kebijakan, tetapi setiap pelanggaran tetap dilaporkan dalam
audit. Jika Anda tidak mengonfigurasi namespace apa pun, hanya namespace gatekeeper-system yang telah dikonfigurasi sebelumnya sebagai dikecualikan dari penerapan webhook penerimaan Pengontrol Kebijakan.
Mengonfigurasi namespace yang dikecualikan
Mengonfigurasi namespace yang dapat dikecualikan akan menerapkan label
admission.gatekeeper.sh/ignore, yang mengecualikan namespace dari penegakan webhook penerimaan
Pengontrol Kebijakan. Jika Anda menghapus namespace yang dapat dikecualikan nanti,
Pengontrol Kebijakan tidak akan menghapus label admission.gatekeeper.sh/ignore
dari namespace.
Mengecualikan namespace dari penegakan
Anda dapat mengecualikan namespace baik
selama penginstalan Pengontrol Kebijakan,
atau setelah penginstalan. Proses berikut menunjukkan cara mengecualikan namespace setelah penginstalan.
Konsol
Di Google Cloud konsol, buka halaman Policy GKE Enterprise di bagian Posture Management.
Di tab Settings, pada tabel cluster, pilih Editedit di kolom Edit configuration.
Luaskan menu Edit Policy Controller configuration.
Di kolom Namespace yang dikecualikan, berikan daftar namespace yang valid.
Objek di namespace ini diabaikan oleh semua kebijakan. Namespace belum perlu ada.
Pilih Simpan perubahan.
gcloud
Untuk menambahkan namespace ke daftar namespace yang mungkin dikecualikan dari
penerapan oleh webhook penerimaan, jalankan perintah berikut:
MEMBERSHIP_NAME: nama keanggotaan
cluster terdaftar yang akan dikecualikan namespace-nya. Anda dapat menentukan beberapa keanggotaan yang dipisahkan dengan koma.
NAMESPACE_LIST: daftar namespace yang dipisahkan koma yang ingin Anda kecualikan dari penerapan oleh Policy Controller.
Perintah ini hanya mengecualikan resource dari webhook penerimaan. Resource masih diaudit. Untuk mengecualikan namespace dari audit, tetapkan
pengecualian di tingkat paket kebijakan:
BUNDLE_NAME dengan nama paket kebijakan yang ingin Anda perbarui dengan namespace yang dikecualikan.
MEMBERSHIP_NAME: nama keanggotaan
cluster terdaftar yang akan dikecualikan namespace-nya. Anda dapat menentukan beberapa keanggotaan yang dipisahkan dengan koma.
NAMESPACE_LIST: daftar namespace yang dipisahkan koma yang ingin Anda kecualikan dari penerapan oleh Policy Controller.
Namespace yang dikecualikan dari penegakan
Berikut beberapa namespace yang dapat dibuat oleh Google Kubernetes Engine (GKE) dan produk terkait. Anda dapat mengecualikannya dari penegakan untuk menghindari dampak yang tidak diinginkan:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-01 UTC."],[],[],null,["This page describes how to configure exempt namespaces in Policy Controller.\n| **Caution:** Namespace exemption from the admission webhook is possible only on Standard clusters. For Autopilot clusters, you can [define exemptions on the constraint](/kubernetes-engine/enterprise/policy-controller/docs/how-to/creating-policy-controller-constraints#constraint) instead.\n\nExempt namespaces remove a namespace from admission webhook enforcement with\nPolicy Controller, but any violations are still reported in\n[audit](/kubernetes-engine/enterprise/policy-controller/docs/how-to/auditing-constraints). If you don't configure any\nnamespaces, only the `gatekeeper-system` namespace is pre-configured as exempt\nfrom the Policy Controller admission webhook enforcement.\n\nConfigure exempt namespaces\n\nConfiguring an exemptable namespace applies the\n`admission.gatekeeper.sh/ignore` label, which exempts the namespace from Policy Controller\nadmission webhook enforcement. If you later remove an exemptable namespace,\nPolicy Controller does not remove the `admission.gatekeeper.sh/ignore` label\nfrom the namespace.\n\nExempt namespaces from enforcement\n\nYou can exempt namespaces either\n[during Policy Controller installation](/kubernetes-engine/enterprise/policy-controller/docs/how-to/installing-policy-controller#installing),\nor after installation. The following process shows you how to exempt namespaces\nafter installation. \n\nConsole\n\n1. In the Google Cloud console, go to the **Policy** page under the **Posture Management** section.\n\n \u003cbr /\u003e\n\n [Go to Policy](https://console.cloud.google.com/kubernetes/policy_controller)\n2. Under the **Settings** tab, in the cluster table, select **Edit** *edit* in the **Edit configuration** column.\n3. Expand the **Edit Policy Controller configuration** menu.\n4. In the **Exempt namespaces** field, provide a list of valid namespaces. Objects in these namespaces are ignored by all policies. The namespaces don't need to exist yet.\n5. Select **Save changes**.\n\ngcloud\n\nTo add namespaces to the list of namespaces that may be exempted from\nenforcement by the admission webhook, run the following command: \n\n gcloud container fleet policycontroller update \\\n --memberships=\u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e \\\n --exemptable-namespaces=[\u003cvar translate=\"no\"\u003eNAMESPACE_LIST\u003c/var\u003e]\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e: the membership name of the registered cluster to exempt namespaces on. You can specify multiple memberships separated by a comma.\n- \u003cvar translate=\"no\"\u003eNAMESPACE_LIST\u003c/var\u003e: a comma-separated list of namespaces that you want Policy Controller to exempt from enforcement.\n\nThis command exempts resources only from the admission webhook. The resources\nare still audited. To instead exempt namespaces from audit, set the\nexemption at the policy bundle level instead: \n\n gcloud container fleet policycontroller content bundles set \u003cvar translate=\"no\"\u003eBUNDLE_NAME\u003c/var\u003e \\\n --memberships=\u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e \\\n --exempted-namespaces=[\u003cvar translate=\"no\"\u003eNAMESPACE_LIST\u003c/var\u003e]\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eBUNDLE_NAME\u003c/var\u003e with the name of the policy bundle that you want to update with exempted namespaces.\n- \u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e: the membership name of the registered cluster to exempt namespaces on. You can specify multiple memberships separated by a comma.\n- \u003cvar translate=\"no\"\u003eNAMESPACE_LIST\u003c/var\u003e: a comma-separated list of namespaces that you want Policy Controller to exempt from enforcement.\n\nNamespaces to exempt from enforcement\n\nThese are some namespaces which could be created by Google Kubernetes Engine (GKE)\nand related products. You may want to exempt them from enforcement to avoid\nundesired impact: \n\n - anthos-creds\n - anthos-identity-service\n - apigee\n - apigee-system\n - asm-system\n - capi-kubeadm-bootstrap-system\n - capi-system\n - cert-manager\n - cnrm-system\n - config-management-monitoring\n - config-management-system\n - gke-connect\n - gke-gmp-system\n - gke-managed-cim\n - gke-managed-filestorecsi\n - gke-managed-metrics-server\n - gke-managed-system\n - gke-system\n - gmp-public\n - gmp-system\n - hnc-system\n - istio-system\n - kube-node-lease\n - kube-public\n - kube-system\n - poco-trial\n - resource-group-system\n - vm-system"]]