Skip to content

Instantly share code, notes, and snippets.

@yosshy
Created June 20, 2022 01:16
Show Gist options
  • Save yosshy/cca8089771bf6437745d251cd6e1e952 to your computer and use it in GitHub Desktop.
Save yosshy/cca8089771bf6437745d251cd6e1e952 to your computer and use it in GitHub Desktop.
Patch for Kubespray to use non-graceful shutdown capability and to build 4 nodes cluster with 1 controller
diff --git a/Vagrantfile b/Vagrantfile
index 1cfa72c8..5bcdee30 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -43,7 +43,7 @@ if File.exist?(CONFIG)
end
# Defaults for config options defined in CONFIG
-$num_instances ||= 3
+$num_instances ||= 4
$instance_name_prefix ||= "k8s"
$vm_gui ||= false
$vm_memory ||= 2048
@@ -59,9 +59,9 @@ $multi_networking ||= "False"
$download_run_once ||= "True"
$download_force_cache ||= "False"
# The first three nodes are etcd servers
-$etcd_instances ||= $num_instances
+$etcd_instances ||= 1
# The first two nodes are kube masters
-$kube_master_instances ||= $num_instances == 1 ? $num_instances : ($num_instances - 1)
+$kube_master_instances ||= 1
# All nodes are kube nodes
$kube_node_instances ||= $num_instances
# The following only works when using the libvirt provider
@@ -246,6 +246,7 @@ Vagrant.configure("2") do |config|
# And limit the action to gathering facts, the full playbook is going to be ran by testcases_run.sh
if i == $num_instances
node.vm.provision "ansible" do |ansible|
+ ansible.compatibility_mode = "2.0"
ansible.playbook = $playbook
ansible.verbose = $ansible_verbosity
$ansible_inventory_path = File.join( $inventory, "hosts.ini")
diff --git a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
index c0b6fca8..0c175f05 100644
--- a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
+++ b/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
@@ -155,6 +155,9 @@ kube_encrypt_secret_data: false
# kubelet_shutdown_grace_period: 60s
# kubelet_shutdown_grace_period_critical_pods: 20s
+kube_feature_gates:
+ - NodeOutOfServiceVolumeDetach=true
+
# DNS configuration.
# Kubernetes cluster name, also will be used as DNS domain
cluster_name: cluster.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment