Purpose and Tuning Philosophy
Tune only the parts that match the failure mode you are seeing:- increase control plane tolerance when leader election or reconciles are unstable
- increase admission tolerance when webhook API calls are slow or throttled
- increase external dependency tolerance when Kubex or Prometheus calls take longer
- increase resource and placement resilience when the controller is starved or frequently rescheduled
What “Slow Cluster Tolerance” Means
In this chart, slow cluster tolerance means the controller and webhooks continue operating safely when:- Kubernetes API requests are slow or bursty
- leader election renewals are delayed
- admission webhook owner lookups take longer
- the controller is CPU or memory constrained
- nodes are under pressure, tainted, or uneven across zones
Exposed Helm/Runtime Knobs
Validate all tuning changes against these implementation-backed settings.Control Plane Tolerance
controllerManager.leaderElection.leaseDurationcontrollerManager.leaderElection.renewDeadlinecontrollerManager.leaderElection.retryPeriodcontrollerManager.globalConfigReconcileIntervalcontrollerManager.extraArgsfor:--kube-api-qps--kube-api-burst--max-concurrent-reconciles--pprof-bind-address
- leader election values are rendered into manager args in
templates/_helpers.tpl globalConfigReconcileIntervalis passed asGLOBAL_CONFIG_RECONCILE_INTERVALintemplates/deployment.yamlextraArgsis appended directly to the manager command line intemplates/_helpers.tpl
Admission/Webhook Tolerance
webhook.timeoutSecondswebhook.podMutation.additionalWebhook.enabledcontrollerManager.podAdmissionWebhookKubeAPIQPScontrollerManager.podAdmissionWebhookKubeAPIBurstglobalConfiguration.webhookOwnerResolutionRetryTimeoutglobalConfiguration.webhookHealth.failureThresholdglobalConfiguration.webhookHealth.successThresholdglobalConfiguration.webhookHealth.transitionCheckIntervalglobalConfiguration.webhookProbe.imageglobalConfiguration.webhookProbe.labelsglobalConfiguration.webhookProbe.annotationsglobalConfiguration.webhookProbe.resourcesglobalConfiguration.webhookProbe.podSecurityContextglobalConfiguration.webhookProbe.securityContext
controllerManager.podAdmissionWebhookKubeAPIQPSdefaults to-1, which disables client-side rate limiting for the pod admission webhook clientcontrollerManager.podAdmissionWebhookKubeAPIBurstdefaults to0; with QPS disabled, this is not acting as a practical cap by default- lowering the webhook client from the default unlimited behavior to a small positive QPS can introduce client-side throttling and increase missed mutation during API slowness
- use these settings mainly when you intentionally want to cap or shape webhook API pressure, not as a default throughput optimization
- most installations should leave
webhook.podMutation.additionalWebhook.enableddisabled; enable it when another mutating webhook must see Kubex-updated resources to make its admission decision - enabling
webhook.podMutation.additionalWebhook.enabledroughly doubles Pod admission traffic because both registrations call the same handler; dry-run health-probe Pods also invoke both registrations - keep defaults
webhook.podMutation.additionalWebhook.namePrefix: 000-andwebhook.podMutation.namePrefix: zzz-for intended early and late placement; ordering is best-effort because Kubernetes does not define mutating webhook order as a stable API contract
Admission Webhook Fail-Open Semantics
The pod mutating webhook is fail-open.- Pod mutation uses
failurePolicy: Ignoreintemplates/mutatingwebhook.yaml - Pod creation continues even if the webhook hits Kubernetes API communication failures
- Pod creation continues even if the webhook hits internal or runtime errors
- The result is missed mutation, not blocked admission
- Proactive automation can still pause later if webhook health becomes unhealthy
internal/webhook/v1alpha1/podrightsizing_webhook.go, where the webhook logs admission errors but always returns nil from Default().
Validating webhooks are also fail-open by default, but configurable:
templates/validatingwebhook.yamlusesfailurePolicy: {{ .Values.webhook.failurePolicy }}values.yamldefaultswebhook.failurePolicytoIgnore- operators can change that behavior if they intentionally want stricter validation semantics
External Dependency Tolerance
globalConfiguration.kubexAPIRequestTimeoutglobalConfiguration.prometheus.requestTimeoutglobalConfiguration.recommendationReloadIntervalglobalConfiguration.rescanInterval
Resource and Placement Resilience
resourcesgateway.resourceslivenessProbereadinessProbereplicaCountnodeSelectortolerationsaffinitytopologySpreadConstraints
Scenario-Based Tuning Playbooks
Very Slow API Server / Unstable Leader Election
Symptoms:- controller restarts or leadership changes during API slowness
- reconcile gaps after short control plane stalls
- increase
controllerManager.leaderElection.leaseDuration - increase
controllerManager.leaderElection.renewDeadline - increase
controllerManager.leaderElection.retryPeriod - consider slightly increasing
controllerManager.globalConfigReconcileInterval
Slow Admission Path on Very Slow API Server
Symptoms:- webhook health flaps during API slowness
- new pods are admitted but miss mutation more often
- webhook logs show API timeout or throttling behavior
- increase
webhook.timeoutSeconds - increase
globalConfiguration.webhookOwnerResolutionRetryTimeout - increase webhook health tolerance before marking unhealthy
- leave
controllerManager.podAdmissionWebhookKubeAPIQPS: -1unless you intentionally want a client-side cap - if you do need a cap, set
controllerManager.podAdmissionWebhookKubeAPIQPSandcontrollerManager.podAdmissionWebhookKubeAPIBursthigh enough that they do not become the new bottleneck
successThreshold: 2 recovers webhook health faster after transient API stalls. successThreshold: 3 is more conservative and recovers slower. This example uses 2 deliberately for very slow API server scenarios; chart default remains 3.
Combined very slow API server example:
Restrictive Admission Environment Blocking Webhook Probe Pods
The probe submits a dry-run Pod for admission; no container runs. Helm defaults setrunAsNonRoot: true, seccompProfile.type: RuntimeDefault, allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, and capabilities.drop: [ALL]. Partial security settings retain other chart defaults; explicit overrides remain supported. Directly managed GlobalConfiguration resources must set these controls themselves under spec.webhookProbe.
Symptoms:
- webhook health stays unhealthy
- dry-run probe pods are denied by image policy, pod security policy, or admission controls
- proactive automation pauses even though the webhook server is reachable
- set an allowed
globalConfiguration.webhookProbe.image - add required
globalConfiguration.webhookProbe.labelsorannotations - add compliant
globalConfiguration.webhookProbe.resources - set
globalConfiguration.webhookProbe.podSecurityContextandsecurityContextto match cluster requirements
GlobalConfiguration, especially after upgrades with retained Helm values or custom overrides. Disable the four probe exceptions while keeping Kyverno policies enforced. Confirm repeated probe success and PodAdmissionWebhookHealthy=True. Then apply the verified configuration in SAP’s environment and remove the exceptions there. Successful rendering alone does not prove admission under SAP’s actual policies.
Controller CPU/Memory Starvation
Symptoms:- slow reconciles
- pod restarts from OOMKills
- delayed webhook handling during bursts
- increase
resources - increase
gateway.resourcesif recommendation fetch or gateway processing is the bottleneck - review
livenessProbeandreadinessProbetiming only if restarts are probe-related rather than actual crashes - consider
replicaCount: 2or higher together with stable placement and leader election tolerance
Large/Noisy Clusters with Throttling or Backlog
Symptoms:- client-side throttling
- reconcile backlog during cluster churn
- webhook owner lookups slowed by API contention
- add
controllerManager.extraArgsfor--kube-api-qpsand--kube-api-burst - add
controllerManager.extraArgsfor--max-concurrent-reconciles - keep the webhook client at its default unlimited setting unless you intentionally need a cap there too
- avoid pushing concurrency so high that the controller becomes CPU starved
Node Pressure / Taints / Zone Instability
Symptoms:- controller pods evicted or rescheduled frequently
- all replicas land on one unstable node or zone
- infra or dedicated ops nodes require explicit tolerations/selectors
- set
nodeSelector,tolerations, andaffinity - add
topologySpreadConstraints - increase
replicaCountfor better availability - size
resourcesso placement on infra nodes remains schedulable
Example Values Snippets
Very Slow API Server
Slow Admission Path on Very Slow API Server
Combined Very Slow API Server
Restrictive Probe Admission/Image Policy
Large-Cluster Throttling
HA/Infra-Node Placement
Validation Checklist
Before rollout:- confirm each tuned knob is exposed in Helm values or passed via
controllerManager.extraArgs - confirm leader election ordering remains valid:
leaseDuration > renewDeadline > retryPeriod - confirm
webhook.timeoutSecondsstill fits your admission SLOs - confirm probe pod image, labels, annotations, and security settings satisfy cluster policy
- confirm added concurrency does not exceed available CPU and memory
- confirm you did not accidentally introduce webhook client-side throttling by replacing the default
podAdmissionWebhookKubeAPIQPS: -1with an unnecessarily low positive value - confirm placement rules still allow scheduling in the target cluster
- check
kubectl get globalconfiguration global-config -o yaml - verify
status.conditions[type=PodAdmissionWebhookHealthy].statusbecomesTrue - inspect controller logs for leader election churn, API throttling, or repeated webhook-health transitions
- create a new test pod and verify whether mutation is applied as expected
- confirm degraded admission behavior matches expectations: pod creation should continue even if mutation is skipped
Troubleshooting and Rollback
If tuning does not help:- revert to the previous Helm values file or use
helm upgrade --reset-then-reuse-valueswith the prior settings - back out aggressive concurrency or QPS increases first
- if webhook probe health is the issue, fix probe admission compatibility before changing broader automation settings
- if the cluster remains unstable, prefer slower but predictable settings over aggressive throughput tuning
- pod mutation webhook failures should normally surface as missing mutation, not rejected pod creation
- proactive automation may still pause when webhook health becomes unhealthy
- validating webhook fail-open behavior depends on
webhook.failurePolicy, which defaults toIgnore

