diff --git a/ansible/roles/k8s-api-ha/tasks/main.yml b/ansible/roles/k8s-api-ha/tasks/main.yml index 451a749..5b10f59 100644 --- a/ansible/roles/k8s-api-ha/tasks/main.yml +++ b/ansible/roles/k8s-api-ha/tasks/main.yml @@ -30,7 +30,4 @@ group: root mode: '0644' notify: Restart_keepalived - when: ansible_distribution == "Debian" and ansible_distribution_major_version == "12" - - - + when: ansible_distribution == "Debian" and ( ansible_distribution_major_version == "12" or ansible_distribution_major_version == "13" ) diff --git a/ansible/roles/k8s-api-ha/templates/haproxy.cfg.j2 b/ansible/roles/k8s-api-ha/templates/haproxy.cfg.j2 index 2a3741a..e1d75d9 100644 --- a/ansible/roles/k8s-api-ha/templates/haproxy.cfg.j2 +++ b/ansible/roles/k8s-api-ha/templates/haproxy.cfg.j2 @@ -20,7 +20,7 @@ frontend kubernetes_api backend k8s_masters option tcp-check - balance roundrobin + balance source {% for srv in haproxy_backend_server %} - server {{ srv.backend_name }} {{ srv.backend_ip }}:{{ srv.backend_port }} check fall 3 rise 2 + server {{ srv.backend_name }} {{ srv.backend_ip }}:{{ srv.backend_port }} check inter 5s fall 3 rise 2 {% endfor %} diff --git a/ansible/roles/k8s-api-ha/vars/main.yml b/ansible/roles/k8s-api-ha/vars/main.yml index d71108b..b76fb8a 100644 --- a/ansible/roles/k8s-api-ha/vars/main.yml +++ b/ansible/roles/k8s-api-ha/vars/main.yml @@ -6,10 +6,9 @@ pkg_list: haproxy_bind_port: "6443" haproxy_backend_server: - - { backend_name: "k8s-cr01", backend_ip: "192.168.111.191", backend_port: "6443"} - - { backend_name: "k8s-cr02", backend_ip: "192.168.111.192", backend_port: "6443"} - - { backend_name: "k8s-cr03", backend_ip: "192.168.111.193", backend_port: "6443"} + - { backend_name: "k8s01-ctr01.lab.loc", backend_ip: "192.168.1.101", backend_port: "6443"} + - { backend_name: "k8s01-ctr02.lab.loc", backend_ip: "192.168.1.102", backend_port: "6443"} + - { backend_name: "k8s01-ctr03.lab.loc", backend_ip: "192.168.1.103", backend_port: "6443"} -keepalived_vip: "192.168.111.190/24" +keepalived_vip: "192.168.1.190/24" keepalived_auth_pass: "1q2w3e4r" - diff --git a/ansible/roles/k8s-deploy-cluster/tasks/k8s-pre.yml b/ansible/roles/k8s-deploy-cluster/tasks/k8s-pre.yml index 9a42129..d7708ca 100644 --- a/ansible/roles/k8s-deploy-cluster/tasks/k8s-pre.yml +++ b/ansible/roles/k8s-deploy-cluster/tasks/k8s-pre.yml @@ -38,7 +38,6 @@ creates: /etc/apt/keyrings/kubernetes-apt-keyring.gpg when: not kube_keyring.stat.exists - - name: Add Kubernetes apt repository apt_repository: repo: "{{ k8s_repo_url }}" @@ -61,9 +60,6 @@ shell: | containerd config default > /etc/containerd/config.toml - args: - creates: /etc/containerd/config.toml - - name: Ensure SystemdCgroup = true replace: path: /etc/containerd/config.toml @@ -71,9 +67,9 @@ replace: '\1true' notify: Restart_containerd -- name: Update pause image to 3.9 +- name: Update pause image to 3.10.1 replace: path: /etc/containerd/config.toml - regexp: 'registry.k8s.io/pause:3.6' - replace: 'registry.k8s.io/pause:3.9' + regexp: 'registry.k8s.io/pause:3.8' + replace: 'registry.k8s.io/pause:3.10.1' notify: Restart_containerd diff --git a/ansible/roles/k8s-deploy-cluster/tasks/main.yml b/ansible/roles/k8s-deploy-cluster/tasks/main.yml index 3000d21..1ac5f42 100644 --- a/ansible/roles/k8s-deploy-cluster/tasks/main.yml +++ b/ansible/roles/k8s-deploy-cluster/tasks/main.yml @@ -2,9 +2,7 @@ - block: -# - include_tasks: k8s-pre.yml - - include_tasks: k8s-control-plane-setup.yml + - include_tasks: k8s-pre.yml +# - include_tasks: k8s-control-plane-setup.yml - - - when: ansible_distribution == "Debian" and ansible_distribution_major_version == "12" + when: ansible_distribution == "Debian" and ( ansible_distribution_major_version == "12" or ansible_distribution_major_version == "13" ) diff --git a/ansible/roles/k8s-deploy-cluster/vars/main.yml b/ansible/roles/k8s-deploy-cluster/vars/main.yml index d0e5810..863269e 100644 --- a/ansible/roles/k8s-deploy-cluster/vars/main.yml +++ b/ansible/roles/k8s-deploy-cluster/vars/main.yml @@ -1,8 +1,8 @@ --- -k8s_apt_key_url: "https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key" -k8s_repo_url: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /" +k8s_apt_key_url: "https://pkgs.k8s.io/core:/stable:/v1.34/deb/Release.key" +k8s_repo_url: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.34/deb/ /" k8s_pkg_list: - apt-transport-https @@ -16,10 +16,9 @@ k8s_pkg_list: - kubectl -k8s_clusterApi: "k8s-cl01-api.k8s-test.local:6443" -k8s_clusterName: "k8s-cl01.k8s-test.local" +k8s_clusterApi: "k8s01-api.lab.loc:6443" +k8s_clusterName: "k8s-cl01.k8s-cl01.local" k8s_dnsDomain: "k8s-cl01.local" k8s_podSubnet: "10.111.111.0/16" k8s_calico_manifest_file: "https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/calico.yaml" -