[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Configure Policy Controller for high availability\n\nYou can set deployment-level configurations for Policy Controller that\noverride resource requirements and configure parameters for high availability.\n\nThis page is for IT administrators and Operators who want to ensure\nthat all resources running within the cloud platform meet organizational\ncompliance requirements by providing and maintaining automation to audit or\nenforce, and who manage the lifecycle of the underlying tech infrastructure. To\nlearn more about common roles and example tasks that we reference in\nGoogle Cloud content, see\n[Common GKE user roles and tasks](/kubernetes-engine/enterprise/docs/concepts/roles-tasks).\n\nTo get a list of all configuration options, run\n`gcloud container fleet policycontroller deployment set --help`.\n\nThe commands on this page use the `--all-memberships` flag to apply a configuration\nto all clusters registered to a fleet. To apply a command to a single, registered\ncluster instead, use `--membership=`\u003cvar class=\"edit\" translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e,\nreplacing \u003cvar translate=\"no\"\u003eMEMBERSHIP_NAME\u003c/var\u003e with the membership name of the\nregistered cluster.\n\nConfigure replica counts\n------------------------\n\nYou can configure your Policy Controller deployments for a\n[`ReplicaSet`](https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/)\nby setting a replica count.\n| **Note:** You can't set replica counts for audit deployments.\n\nTo set a replica count, run the following command: \n\n gcloud container fleet policycontroller deployment set \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e replica-count \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you want to set a replica count for. The value is either `mutation` or `admission`.\n- \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e: the number of replicas that you want to set, for example 3.\n\nTo remove a replica count, run the following command: \n\n gcloud container fleet policycontroller deployment remove \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e replica-count \\\n --all-memberships\n\nReplace \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e with the deployment type that you're\nremoving the replicas from. This value is either `mutation` or `admission`.\n\nSet resource requirements\n-------------------------\n\nYou can specify limits and requests for memory and CPU.\n\n### Set memory limits and requests\n\nTo set a memory limit, run the following command: \n\n gcloud container fleet policycontroller deployment set \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e memory-limit \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you want to set a memory limit on. One of the following values: `audit`, `mutation`, or `admission`.\n- \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e: the quantity that you want to set with a [quantity suffix](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory), for example 4Gi.\n\nTo set a memory request, run the following command: \n\n gcloud container fleet policycontroller deployment set \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e memory-request \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you want to set a memory request on. One of the following values: `audit`, `mutation`, or `admission`.\n- \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e: the quantity that you want to set with a [quantity suffix](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory), for example 2Gi.\n\n### Set CPU limits and requests\n\nTo set a CPU limit, run the following command: \n\n gcloud container fleet policycontroller deployment set \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e cpu-limit \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you want to set a CPU limit on. One of the following values: `audit`, `mutation`, or `admission`.\n- \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e: the [CPU quantity](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu) that you want to set, for example 500m.\n\nTo set a CPU request, run the following command: \n\n gcloud container fleet policycontroller deployment set \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e cpu-request \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you want to set a CPU request on. One of the following values: `audit`, `mutation`, or `admission`.\n- \u003cvar translate=\"no\"\u003eQUANTITY\u003c/var\u003e: the quantity that you want to set, for example 250m.\n\n### Remove limits and requests\n\nTo remove a configuration, run the following command: \n\n gcloud container fleet policycontroller deployment remove \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e \\\n --all-memberships\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_TYPE\u003c/var\u003e: the deployment type that you're removing the request or limit on. One of the following values: `audit`, `mutation`, or `admission`.\n- \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e: the resource type that you want to remove. One of the following values: `memory-limit`, `memory-request`, `cpu-limit`, `cpu-request`.\n\nConfigure tolerations\n---------------------\n\nYou can set [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) on your Policy Controller deployments.\n\nYou can set a toleration with one of the following methods:\n\n- To set a toleration with a key, run the following command:\n\n gcloud container fleet policycontroller deployment set admission toleration \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e \\\n --all-memberships\n\n Replace \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e with your key value, for example `key1`.\n- To set a toleration with a key and value, run the following command:\n\n gcloud container fleet policycontroller deployment set admission toleration \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eKEY\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e \\\n --all-memberships\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e: your key value, for example `key1`.\n - \u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e: your key value, for example `value1`.\n- To set a toleration with a key and value, and the effect `NoSchedule`, run the\n following command:\n\n gcloud container fleet policycontroller deployment set admission toleration \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eKEY\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e \\\n --all-memberships \\\n --effect=NoSchedule\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e: your key value, for example `key1`.\n - \u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e: your key value, for example `value1`.\n\nIf you need to edit a toleration, you must remove the existing toleration and then\nset a new toleration with one of the previous commands. To remove a toleration,\nrun the previous command with `remove` instead of `set`, for example: \n\n gcloud container fleet policycontroller deployment remove admission toleration \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eKEY\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003eVALUE\u003c/var\u003e \\\n --all-memberships\n\nConfigure affinity\n------------------\n\nYou can set [pod affinity](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) on your Policy Controller deployments. The available settings are `anti` (corresponding to anti-affinity) and `none` (corresponding to no-affinity). For the `admissions` deployment, `anti` is the default. For all other deployments, `none` is the default.\n\nTo set pod anti-affinity, run the following command: \n\n gcloud container fleet policycontroller deployment set mutation pod-affinity anti \\\n --all-memberships\n\nTo remove pod affinity, run the following command: \n\n gcloud container fleet policycontroller deployment set mutation pod-affinity none \\\n --all-memberships"]]