apiVersion:customize.core.cnrm.cloud.google.com/v1beta1kind:NamespacedControllerReconcilermetadata:name:cnrm-controller-manager# name must not contain the namespace ID suffixnamespace:NAMESPACEspec:rateLimit:qps:80# the default value is 20burst:40# the default value is 30
請將 NAMESPACE 替換成您的命名空間名稱。
使用 kubectl apply 將速率限制設定套用至叢集:
kubectl apply -f configure-rate-limit.yaml
執行下列指令,確認設定是否成功:
kubectl get namespacedcontrollerreconciler cnrm-controller-manager -n NAMESPACE -o jsonpath='{.status.healthy}'
apiVersion:customize.core.cnrm.cloud.google.com/v1alpha1kind:ControllerReconcilermetadata:name:cnrm-controller-managerspec:rateLimit:qps:80# the default value is 20burst:40# the default value is 30
[[["容易理解","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 (世界標準時間)。"],[[["\u003cp\u003eConfig Connector's controller manager rate limit can be configured to control the number of requests made to the Kubernetes API server.\u003c/p\u003e\n"],["\u003cp\u003eThe rate limit is defined by \u003ccode\u003eqps\u003c/code\u003e (queries per second) which determines the average request rate, and \u003ccode\u003eburst\u003c/code\u003e which allows for temporary higher request volumes.\u003c/p\u003e\n"],["\u003cp\u003eIn namespaced mode (version 1.119+), the \u003ccode\u003eNamespacedControllerReconciler\u003c/code\u003e custom resource is used to set the rate limit, specifying \u003ccode\u003eqps\u003c/code\u003e and \u003ccode\u003eburst\u003c/code\u003e values within a given namespace.\u003c/p\u003e\n"],["\u003cp\u003eIn cluster mode (version 1.125+), the \u003ccode\u003eControllerReconciler\u003c/code\u003e custom resource is used to configure the \u003ccode\u003ecnrm-controller-manager\u003c/code\u003e's rate limit, defining \u003ccode\u003eqps\u003c/code\u003e and \u003ccode\u003eburst\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Configure the controller manager rate limit\n===========================================\n\n*** ** * ** ***\n\nThis pages describes how to configure the overall rate limit (token bucket rate\nlimit) for the controller manager in Config Connector.\n\nThe rate limit controls how many requests Config Connector makes to the\nKubernetes API server. There are two settings:\n\n- The `qps` (queries per second) setting determines\n the average rate at which Config Connector can make requests to the\n Kubernetes API server.\n\n- The `burst` value allows for more requests than the `qps` limit\n for short periods. This helps Config Connector to reconcile\n quickly, even during times which require more queries to the Kubernetes\n API server, such as when applying a new batch of configuration using GitOps.\n\nYou can think of the \"token bucket\" algorithm for rate limiting like this:\nimagine a bucket of capacity `burst` tokens, being refilled at the `qps`\nrate. Each request requires one token from the bucket. If the bucket is empty,\nrequests are delayed until tokens become available.\n\nConfigure the rate limit for namespaced controller manager\n----------------------------------------------------------\n\nIf Config Connector is configured to run in\n[namespaced mode](/config-connector/docs/how-to/install-namespaced), you can\nuse the `NamespacedControllerReconciler` custom resource to configure the rate\nlimit of the `cnrm-controller-manager` controller's Kubernetes client\nin your designated namespace. You can configure rate limit for this\ncontroller in Config Connector version 1.119 and later.\n\n1. Create a file named `configure-rate-limit.yaml` and copy the\n following YAML into it:\n\n apiVersion: customize.core.cnrm.cloud.google.com/v1beta1\n kind: NamespacedControllerReconciler\n metadata:\n name: cnrm-controller-manager # name must not contain the namespace ID suffix\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE\u003c/span\u003e\u003c/var\u003e\n spec:\n rateLimit:\n qps: 80 # the default value is 20\n burst: 40 # the default value is 30\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e with the name of your namespace.\n2. Use `kubectl apply` to apply the rate limit configuration to your cluster:\n\n ```\n kubectl apply -f configure-rate-limit.yaml\n ```\n3. Verify the configuration is successful by running the following command:\n\n ```\n kubectl get namespacedcontrollerreconciler cnrm-controller-manager -n NAMESPACE -o jsonpath='{.status.healthy}'\n ```\n\n The output should display `status.healthy` field set to `true`.\n4. Verify that the `--qps` and `--burst` flags are added to the\n `cnrm-controller-manager` controller's manager container by running the following command:\n\n ```\n kubectl describe statefulsets -n cnrm-system -l \"cnrm.cloud.google.com/scoped-namespace=NAMESPACE\"\n ```\n\n The output should contain the following: \n\n Containers:\n manager:\n Image: gcr.io/gke-release/cnrm/controller:fd4c42c\n Port: 23232/TCP\n Host Port: 0/TCP\n Command:\n /configconnector/manager\n Args:\n --qps=80\n --burst=40\n --scoped-namespace=config-control\n --prometheus-scrape-endpoint=:8888\n\nConfigure the rate limit in cluster mode\n----------------------------------------\n\nStarting in version 1.125, if Config Connector is configured to run in cluster\nmode, you can configure the rate limit of the `cnrm-controller-manager`\ncontroller's Kubernetes client using the `ControllerReconciler` custom resource.\nThe usage is similar to the namespaced mode, but in this case, you should\nuse the `ControllerReconciler` CR instead of `NamespacedControllerReconciler`,\nas in the following example: \n\n apiVersion: customize.core.cnrm.cloud.google.com/v1alpha1\n kind: ControllerReconciler\n metadata:\n name: cnrm-controller-manager\n spec:\n rateLimit:\n qps: 80 # the default value is 20\n burst: 40 # the default value is 30"]]