summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-05-08 01:08:36 +0200
committerChristian Pointner <equinox@spreadspace.org>2022-05-08 01:08:36 +0200
commit09c8120540735c22316a55593f4c56bcd6ae7e88 (patch)
tree5454c662c5919fd5ff0d7618e69da136598d03a9 /roles/kubernetes/kubeadm
parentk8s: rename masters to control-plane nodes (diff)
add support for cluster with kubernetes 1.24
Diffstat (limited to 'roles/kubernetes/kubeadm')
-rw-r--r--roles/kubernetes/kubeadm/control-plane/tasks/primary.yml6
-rw-r--r--roles/kubernetes/kubeadm/control-plane/templates/kubeadm.config.j212
2 files changed, 10 insertions, 8 deletions
diff --git a/roles/kubernetes/kubeadm/control-plane/tasks/primary.yml b/roles/kubernetes/kubeadm/control-plane/tasks/primary.yml
index 22a5af42..450c3a1a 100644
--- a/roles/kubernetes/kubeadm/control-plane/tasks/primary.yml
+++ b/roles/kubernetes/kubeadm/control-plane/tasks/primary.yml
@@ -28,8 +28,8 @@
- name: initialize kubernetes primary control-plane node and store log
block:
- name: initialize kubernetes primary control-plane node
- command: "kubeadm init --config /etc/kubernetes/kubeadm.config --node-name {{ inventory_hostname }}{% if kubernetes_network_plugin_replaces_kube_proxy %} --skip-phases addon/kube-proxy{% endif %} --skip-token-print"
- # command: "kubeadm init --config /etc/kubernetes/kubeadm.config --node-name {{ inventory_hostname }}{% if kubernetes_network_plugin_replaces_kube_proxy %} --skip-phases addon/kube-proxy{% endif %} --token '{{ kubeadm_token_generate.stdout }}' --token-ttl 42m --skip-token-print"
+ command: "kubeadm init --config /etc/kubernetes/kubeadm.config --node-name {{ inventory_hostname }} --skip-token-print"
+ # command: "kubeadm init --config /etc/kubernetes/kubeadm.config --node-name {{ inventory_hostname }} --token '{{ kubeadm_token_generate.stdout }}' --token-ttl 42m --skip-token-print"
args:
creates: /etc/kubernetes/pki/ca.crt
register: kubeadm_init
@@ -47,7 +47,7 @@
content: "{{ kubeadm_init.stderr }}\n"
dest: /etc/kubernetes/kubeadm-init.errors
- - name: create bootstrap token for existing cluster
+ - name: create bootstrap token for new cluster
command: kubeadm token create --ttl 42m
check_mode: no
register: kubeadm_token_generate
diff --git a/roles/kubernetes/kubeadm/control-plane/templates/kubeadm.config.j2 b/roles/kubernetes/kubeadm/control-plane/templates/kubeadm.config.j2
index 2fa98ed6..a0f3efe7 100644
--- a/roles/kubernetes/kubeadm/control-plane/templates/kubeadm.config.j2
+++ b/roles/kubernetes/kubeadm/control-plane/templates/kubeadm.config.j2
@@ -1,6 +1,6 @@
-{# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2 #}
+{# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3 #}
{# #}
-apiVersion: kubeadm.k8s.io/v1beta2
+apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
{# TODO: this is ugly but we want to create our own token so we can #}
{# better control it's lifetime #}
@@ -11,10 +11,14 @@ localAPIEndpoint:
{% if kubernetes_overlay_node_ip is defined %}
advertiseAddress: {{ kubernetes_overlay_node_ip }}
{% endif %}
+{% if kubernetes_network_plugin_replaces_kube_proxy %}
+skipPhases:
+- addon/kube-proxy
+{% endif %}
nodeRegistration:
criSocket: {{ kubernetes_cri_socket }}
---
-apiVersion: kubeadm.k8s.io/v1beta2
+apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
kubernetesVersion: {{ kubernetes_version }}
clusterName: {{ kubernetes.cluster_name }}
@@ -43,8 +47,6 @@ controllerManager:
extraArgs:
node-cidr-mask-size: "{{ kubernetes.pod_ip_range_size }}"
scheduler: {}
-dns:
- type: CoreDNS
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration