Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Ratenbegrenzung für den Controller-Manager konfigurieren
Auf dieser Seite wird beschrieben, wie Sie die Gesamtrate (Token-Bucket-Geschwindigkeitslimit) für den Controller-Manager in Config Connector konfigurieren.
Mit der Ratenbegrenzung wird festgelegt, wie viele Anfragen Config Connector an den Kubernetes API-Server sendet. Es gibt zwei Einstellungen:
Die Einstellung qps (Abfragen pro Sekunde) bestimmt die durchschnittliche Rate, mit der Config Connector Anfragen an den Kubernetes API-Server senden kann.
Der Wert burst ermöglicht für kurze Zeit mehr Anfragen als das Limit qps. So kann Config Connector schnell abgleichen, auch wenn mehr Abfragen an den Kubernetes API-Server erforderlich sind, z. B. beim Anwenden einer neuen Konfigurationsgruppe mit GitOps.
Sie können sich den Token-Bucket-Algorithmus für die Ratenbegrenzung so vorstellen: Stellen Sie sich einen Bucket mit einer Kapazität von burst Tokens vor, der mit einer Rate von qps aufgefüllt wird. Für jede Anfrage ist ein Token aus dem Bucket erforderlich. Wenn der Bucket leer ist, werden Anfragen verzögert, bis Tokens verfügbar sind.
Ratenbegrenzung für den Namespace-Controller-Manager konfigurieren
Wenn Config Connector für die Ausführung im Namespaced-Modus konfiguriert ist, können Sie mit der benutzerdefinierten Ressource NamespacedControllerReconciler das Ratelimit des Kubernetes-Clients des cnrm-controller-manager-Controllers in Ihrem angegebenen Namespace konfigurieren. Sie können die Ratenbeschränkung für diesen Controller in Config Connector Version 1.119 und höher konfigurieren.
Erstellen Sie eine Datei mit dem Namen configure-rate-limit.yaml und kopieren Sie die folgende YAML-Datei hinein:
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
Ersetzen Sie NAMESPACE durch den Namen Ihres Namespace:
Verwenden Sie kubectl apply, um die Konfiguration der Ratenbeschränkung auf Ihren Cluster anzuwenden:
kubectl apply -f configure-rate-limit.yaml
Prüfen Sie mit dem folgenden Befehl, ob die Konfiguration erfolgreich war:
kubectl get namespacedcontrollerreconciler cnrm-controller-manager -n NAMESPACE -o jsonpath='{.status.healthy}'
Die Ausgabe sollte das Feld status.healthy mit dem Wert true enthalten.
Prüfen Sie mit dem folgenden Befehl, ob die Flags --qps und --burst dem Manager-Container des cnrm-controller-manager-Controllers hinzugefügt wurden:
Wenn Config Connector ab Version 1.125 für den Betrieb im Clustermodus konfiguriert ist, können Sie die Ratenbeschränkung des Kubernetes-Clients des cnrm-controller-manager-Controllers mithilfe der benutzerdefinierten Ressource ControllerReconciler konfigurieren.
Die Verwendung ähnelt dem Namespace-Modus, aber in diesem Fall sollten Sie die CR-Zeichenfolge ControllerReconciler anstelle von NamespacedControllerReconciler verwenden, wie im folgenden Beispiel:
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
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\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"]]