make kube cluster deployed with kubespray restartable

This commit is contained in:
Julien Laurenceau 2022-08-01 19:43:11 +02:00
parent c24a3a3b15
commit 6efc648a73
7 changed files with 38 additions and 5 deletions

View file

@ -4,7 +4,7 @@
# dashboard_enabled: false # dashboard_enabled: false
# Helm deployment # Helm deployment
helm_enabled: false helm_enabled: true
# Registry deployment # Registry deployment
registry_enabled: false registry_enabled: false
@ -133,7 +133,7 @@ ingress_alb_enabled: false
# alb_ingress_aws_debug: "false" # alb_ingress_aws_debug: "false"
# Cert manager deployment # Cert manager deployment
cert_manager_enabled: false cert_manager_enabled: true
# cert_manager_namespace: "cert-manager" # cert_manager_namespace: "cert-manager"
# cert_manager_tolerations: # cert_manager_tolerations:
# - key: node-role.kubernetes.io/master # - key: node-role.kubernetes.io/master

View file

@ -162,6 +162,7 @@ cluster_name: cluster.local
ndots: 2 ndots: 2
# Can be coredns, coredns_dual, manual or none # Can be coredns, coredns_dual, manual or none
dns_mode: coredns dns_mode: coredns
dns_min_replicas: 1
# Set manual server if using a custom cluster DNS server # Set manual server if using a custom cluster DNS server
# manual_dns_server: 10.x.x.x # manual_dns_server: 10.x.x.x
# Enable nodelocal dns cache # Enable nodelocal dns cache

View file

@ -74,3 +74,34 @@
state: present state: present
use: apt use: apt
become: true become: true
# Workaround for https://github.com/kubernetes-sigs/kubespray/issues/8850
- name: check if cgroupv2 are enabled
stat:
path: "/sys/fs/cgroup/cgroup.controllers"
# Workaround for https://github.com/kubernetes-sigs/kubespray/issues/8850
- name: Disable Systemd Resolved
become: true
block:
- name: Set default as DNS operational mode
ini_file:
path: "/etc/NetworkManager/NetworkManager.conf"
section: main
option: dns
value: default
no_extra_spaces: yes
- name: Disable systemd-resolved
systemd:
name: systemd-resolved
state: stopped
enabled: no
- name: Remove resolv.conf
file:
path: "/etc/resolv.conf"
state: absent
- name: Restart and enable NetworkManager
systemd:
name: NetworkManager
state: restarted
enabled: yes

View file

@ -20,4 +20,5 @@
- name: cri-dockerd | reload cri-dockerd.service - name: cri-dockerd | reload cri-dockerd.service
service: service:
name: cri-dockerd.service name: cri-dockerd.service
enabled: yes
state: restarted state: restarted

View file

@ -1,2 +1,2 @@
--- ---
kube_resolv_conf: "/run/systemd/resolve/resolv.conf" kube_resolv_conf: "/etc/resolv.conf"

View file

@ -1,2 +1,2 @@
--- ---
kube_resolv_conf: "/run/systemd/resolve/resolv.conf" kube_resolv_conf: "/etc/resolv.conf"

View file

@ -1,2 +1,2 @@
--- ---
kube_resolv_conf: "/run/systemd/resolve/resolv.conf" kube_resolv_conf: "/etc/resolv.conf"