diff --git a/config.sample.yaml b/config.sample.yaml index 67af9a6..5a62249 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -20,6 +20,8 @@ orchestrator: version: v1.30.3 cluster_name: cluster.local kubelet_dir: "/app/k8s/kubelet" + proxy_mode: "ipvs" # iptables, ipvs + proxy_scheduler: "rr" container_engine: install: true type: "containerd" diff --git a/internal/config/orchestrator.go b/internal/config/orchestrator.go index b04be0f..e829462 100644 --- a/internal/config/orchestrator.go +++ b/internal/config/orchestrator.go @@ -17,6 +17,8 @@ type Orchestrator struct { BinDir string `yaml:"bin_dir" env-default:"/usr/local/bin"` SysctlFilePath string `yaml:"sysctl_file_path" env-default:"/etc/sysctl.d/99-sysctl.conf"` LoadbalancerApiserverPort int `yaml:"loadbalancer_apiserver_port" env-default:"6443"` + ProxyMode string `yaml:"proxy_mode" env-default:"ipvs"` + ProxyScheduler string `yaml:"proxy_scheduler" env-default:"rr"` Dns Dns `yaml:"dns"` CloudProvider string `yaml:"cloud_provider"` ExgernalCloudProvider string `yaml:"external_cloud_provider"` diff --git a/internal/resources/templates/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml.tmpl b/internal/resources/templates/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml.tmpl index 0f5cb91..f3a9d74 100644 --- a/internal/resources/templates/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml.tmpl +++ b/internal/resources/templates/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml.tmpl @@ -122,7 +122,8 @@ kube_apiserver_port: 6443 # (https) # Kube-proxy proxyMode configuration. # Can be ipvs, iptables -kube_proxy_mode: ipvs +kube_proxy_mode: {{ .Orchestrator.ProxyMode }} +kube_proxy_scheduler: {{ .Orchestrator.ProxyScheduler }} # configure arp_ignore and arp_announce to avoid answering ARP queries from kube-ipvs0 interface # must be set to true for MetalLB, kube-vip(ARP enabled) to work @@ -452,6 +453,8 @@ kubeadm_patches: source_dir: {{ `"{{ inventory_dir }}/patches"` }} dest_dir: {{ `"{{ kube_config_dir }}/patches"` }} +{{- if not (eq .Orchestrator.KubeletDir "/var/lib/kubelet") }} ## Kubelet additional settings kubelet_custom_flags: - "--root-dir={{ .Orchestrator.KubeletDir }}" +{{- end }} \ No newline at end of file diff --git a/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml b/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml index 353b5c8..95777c4 100644 --- a/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml +++ b/kubespray/inventory/group_vars/k8s_cluster/k8s-cluster.yml @@ -123,6 +123,7 @@ kube_apiserver_port: 6443 # (https) # Kube-proxy proxyMode configuration. # Can be ipvs, iptables kube_proxy_mode: ipvs +kube_proxy_scheduler: lc # configure arp_ignore and arp_announce to avoid answering ARP queries from kube-ipvs0 interface # must be set to true for MetalLB, kube-vip(ARP enabled) to work @@ -404,7 +405,6 @@ kubeadm_patches: enabled: false source_dir: "{{ inventory_dir }}/patches" dest_dir: "{{ kube_config_dir }}/patches" - ## Kubelet additional settings kubelet_custom_flags: - - "--root-dir=/app/k8s/kubelet" + - "--root-dir=/app/k8s/kubelet" \ No newline at end of file