File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
addons/admission-resource-quota-critical-pods Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # critical pods are configured as a limited resource by admission_controller_config.yaml,
2
+ # which means they are disallowed unless explicitly allowed by a namespaced quota object.
3
+ # This quota effectively removes the restriction on the number of critical pods allowed in the kube-system namespace.
4
+ apiVersion : v1
5
+ kind : ResourceQuota
6
+ metadata :
7
+ name : gcp-critical-pods
8
+ namespace : kube-system
9
+ labels :
10
+ addonmanager.kubernetes.io/mode : Reconcile
11
+ spec :
12
+ hard :
13
+ pods : " 1000000000"
14
+ scopeSelector :
15
+ matchExpressions :
16
+ - operator : In
17
+ scopeName : PriorityClass
18
+ values : ["system-node-critical", "system-cluster-critical"]
Original file line number Diff line number Diff line change @@ -915,6 +915,20 @@ kind: AdmissionConfiguration
915
915
plugins:
916
916
EOF
917
917
918
+ # Add resourcequota config to limit critical pods to kube-system by default
919
+ cat << EOF >>/etc/srv/kubernetes/admission_controller_config.yaml
920
+ - name: "ResourceQuota"
921
+ configuration:
922
+ apiVersion: apiserver.config.k8s.io/v1
923
+ kind: ResourceQuotaConfiguration
924
+ limitedResources:
925
+ - resource: pods
926
+ matchScopes:
927
+ - scopeName: PriorityClass
928
+ operator: In
929
+ values: ["system-node-critical", "system-cluster-critical"]
930
+ EOF
931
+
918
932
if [[ " ${ADMISSION_CONTROL:- } " == * " ImagePolicyWebhook" * ]]; then
919
933
if [[ -z " ${GCP_IMAGE_VERIFICATION_URL:- } " ]]; then
920
934
1>&2 echo " The ImagePolicyWebhook admission control plugin was requested, but GCP_IMAGE_VERIFICATION_URL was not provided."
@@ -2528,6 +2542,7 @@ EOF
2528
2542
if echo " ${ADMISSION_CONTROL:- } " | grep -q " LimitRanger" ; then
2529
2543
setup-addon-manifests " admission-controls" " limit-range" " gce"
2530
2544
fi
2545
+ setup-addon-manifests " addons" " admission-resource-quota-critical-pods"
2531
2546
if [[ " ${NETWORK_POLICY_PROVIDER:- } " == " calico" ]]; then
2532
2547
setup-addon-manifests " addons" " calico-policy-controller"
2533
2548
You can’t perform that action at this time.
0 commit comments