diff --git a/roles/kubernetes/control-plane/defaults/main/main.yml b/roles/kubernetes/control-plane/defaults/main/main.yml index ad9456d5b24d286f8a2dd7cca1f4f151f44b92b7..22f4886cb2a329e60fe1cc25b8ae0528f8d6861a 100644 --- a/roles/kubernetes/control-plane/defaults/main/main.yml +++ b/roles/kubernetes/control-plane/defaults/main/main.yml @@ -15,6 +15,9 @@ kube_apiserver_node_port_range: "30000-32767" # ETCD backend for k8s data kube_apiserver_storage_backend: etcd3 +# The interval of compaction requests. If 0, the compaction request from apiserver is disabled. +kube_apiserver_etcd_compaction_interval: "5m0s" + # CIS 1.2.26 # Validate that the service account token # in the request is actually present in etcd. diff --git a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 index bc3b8601eba41507db410cf9eeb01680dabc0eca..dfccb20b273149933e1faece64fb4f2f802db2a2 100644 --- a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 +++ b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 @@ -114,6 +114,9 @@ certificatesDir: {{ kube_cert_dir }} imageRepository: {{ kube_image_repo }} apiServer: extraArgs: +{% if kube_apiserver_etcd_compaction_interval is defined %} + etcd-compaction-interval: "{{ kube_apiserver_etcd_compaction_interval }}" +{% endif %} {% if kube_apiserver_pod_eviction_not_ready_timeout_seconds is defined %} default-not-ready-toleration-seconds: "{{ kube_apiserver_pod_eviction_not_ready_timeout_seconds }}" {% endif %}