bug: stuck

This commit is contained in:
2026-01-01 17:10:55 -05:00
parent b04298adfb
commit 44d59737c7

View File

@@ -1,140 +1,154 @@
- name: Configure compute for the cluster. # - name: Configure compute for the cluster.
hosts: servers # hosts: servers
gather_facts: false # gather_facts: false
vars: # vars:
kubernetes_version: v1.30 # kubernetes_version: v1.30
tasks: # tasks:
- name: Download Kubernetes key. # - name: Download Kubernetes key.
ansible.builtin.apt_key: # ansible.builtin.apt_key:
url: https://pkgs.k8s.io/core:/stable:/{{ kubernetes_version }}/deb/Release.key # url: https://pkgs.k8s.io/core:/stable:/{{ kubernetes_version }}/deb/Release.key
state: present # state: present
- name: Download Kubernetes repository. # - name: Download Kubernetes repository.
ansible.builtin.apt_repository: # ansible.builtin.apt_repository:
repo: "deb https://pkgs.k8s.io/core:/stable:/{{ kubernetes_version }}/deb/ /" # repo: "deb https://pkgs.k8s.io/core:/stable:/{{ kubernetes_version }}/deb/ /"
state: present # state: present
- name: Download CRI-O key. # - name: Download CRI-O key.
ansible.builtin.apt_key: # ansible.builtin.apt_key:
url: https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/Release.key # url: https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/Release.key
state: present # state: present
- name: Download CRI-O repository. # - name: Download CRI-O repository.
ansible.builtin.apt_repository: # ansible.builtin.apt_repository:
repo: "deb https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/ /" # repo: "deb https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/ /"
state: present # state: present
- name: Download Helm key. # - name: Download Helm key.
ansible.builtin.apt_key: # ansible.builtin.apt_key:
url: https://packages.buildkite.com/helm-linux/helm-debian/gpgkey # url: https://packages.buildkite.com/helm-linux/helm-debian/gpgkey
state: present # state: present
- name: Download Helm repository. # - name: Download Helm repository.
ansible.builtin.apt_repository: # ansible.builtin.apt_repository:
repo: "deb https://packages.buildkite.com/helm-linux/helm-debian/any/ any main" # repo: "deb https://packages.buildkite.com/helm-linux/helm-debian/any/ any main"
state: present # state: present
- name: Install packages. # - name: Install packages.
ansible.builtin.apt: # ansible.builtin.apt:
state: present # state: present
update_cache: true # update_cache: true
name: [cri-o, kubelet, kubeadm, kubectl, python3-pip, helm, git] # name: [cri-o, kubelet, kubeadm, kubectl, python3-pip, helm, git]
- name: Install Kubernetes Python packages. # - name: Install Kubernetes Python packages.
ansible.builtin.pip: # ansible.builtin.pip:
name: [kubernetes, pyyaml] # name: [kubernetes, pyyaml]
state: present # state: present
break_system_packages: true # break_system_packages: true
- name: Enable IPv4 forwarding. # - name: Enable `br_netfilter` module.
ansible.posix.sysctl: # community.general.modprobe:
name: net.ipv4.ip_forward # name: br_netfilter
value: '1' # state: present
sysctl_set: true # notify: Reboot the nodes.
notify: Reboot the nodes.
- name: Enable `br_netfilter` module. # - name: Configure `sysctl` permanently.
community.general.modprobe: # ansible.posix.sysctl:
name: br_netfilter # name: '{{ item }}'
state: present # value: '1'
notify: Reboot the nodes. # state: present
# reload: true
# loop:
# - net.bridge.bridge-nf-call-iptables
# - net.ipv4.ip_forward
handlers: # handlers:
- name: Reboot the nodes. # - name: Reboot the nodes.
ansible.builtin.reboot: # ansible.builtin.reboot:
- name: Spawn new cluster on control node. # - name: Spawn new cluster on control node.
hosts: control # hosts: control
gather_facts: false # gather_facts: false
vars: # vars:
config_template: ../templates/InitConfiguration.yml.jinja2 # config_template: ../templates/InitConfiguration.yml.jinja2
config: # config:
bootstrap_token: "{{ secrets.bootstrap_token }}" # bootstrap_token: "{{ secrets.bootstrap_token }}"
node_ip: 10.0.2.11 # node_ip: 10.0.2.11
node_name: control # node_name: control
vars_files: # vars_files:
- ../vault.yml # - ../vault.yml
tasks: # tasks:
- name: Test for cluster. # - name: Test for cluster.
kubernetes.core.k8s_cluster_info: # kubernetes.core.k8s_cluster_info:
register: api_status # register: api_status
ignore_errors: true # ignore_errors: true
- name: Copy configuration over. # - name: Copy configuration over.
ansible.builtin.template: # ansible.builtin.template:
src: "{{ config_template }}" # src: "{{ config_template }}"
dest: InitConfiguration.yml # dest: InitConfiguration.yml
mode: preserve # mode: preserve
when: "api_status.failed" # when: "api_status.failed"
- name: Initialize cluster. # - name: Initialize cluster.
ansible.builtin.command: # ansible.builtin.command:
kubeadm init --config InitConfiguration.yml # kubeadm init --config InitConfiguration.yml
changed_when: true # changed_when: true
when: "api_status.failed" # when: "api_status.failed"
- name: Apply the Kubernetes config to the shell. # - name: Apply the Kubernetes config to the shell.
ansible.builtin.lineinfile: # ansible.builtin.lineinfile:
path: /etc/environment # path: /etc/environment
line: 'KUBECONFIG=/etc/kubernetes/admin.conf' # line: 'KUBECONFIG=/etc/kubernetes/admin.conf'
when: "api_status.failed" # when: "api_status.failed"
- name: Join worker nodes to cluster. # - name: Join worker nodes to cluster.
hosts: [node-a, node-b] # hosts: [node-a, node-b]
vars: # vars:
join_template: ../templates/JoinConfiguration.yml.jinja2 # join_template: ../templates/JoinConfiguration.yml.jinja2
join_control_ip: 10.0.2.11 # join_control_ip: 10.0.2.11
join_bootstrap_token: "{{ secrets.bootstrap_token }}" # join_bootstrap_token: "{{ secrets.bootstrap_token }}"
vars_files: # vars_files:
- ../vault.yml # - ../vault.yml
tasks: # tasks:
- name: Copy join configuration over. # - name: Copy join configuration over.
vars: # vars:
join_worker_ip: "{{ ansible_default_ipv4.address }}" # join_worker_ip: "{{ ansible_default_ipv4.address }}"
join_worker_name: "{{ ansible_hostname }}" # join_worker_name: "{{ ansible_hostname }}"
ansible.builtin.template: # ansible.builtin.template:
src: "{{ join_template }}" # src: "{{ join_template }}"
dest: JoinConfiguration.yml # dest: JoinConfiguration.yml
mode: preserve # mode: preserve
- name: Join the nodes. # - name: Join the nodes.
ansible.builtin.command: # ansible.builtin.command:
kubeadm join --config JoinConfiguration.yml # kubeadm join --config JoinConfiguration.yml
changed_when: true # changed_when: true
- name: Install Helm Diff. # - name: Install Helm Diff.
gather_facts: false # gather_facts: false
hosts: control # hosts: control
tasks: # tasks:
- name: Install it. # - name: Install it.
kubernetes.core.helm_plugin: # kubernetes.core.helm_plugin:
plugin_path: https://github.com/databus23/helm-diff # plugin_path: https://github.com/databus23/helm-diff
state: present # state: present
- name: Install CNI. - name: Install CNI.
gather_facts: false gather_facts: false
hosts: control hosts: control
tasks: tasks:
- name: Assign nodes as workers.
kubernetes.core.k8s:
state: patched
kind: Node
name: "{{ item }}"
definition:
metadata:
labels:
node-role.kubernetes.io/worker: worker
loop: [node-a, node-b]
- name: Create Flannel namespace. - name: Create Flannel namespace.
kubernetes.core.k8s: kubernetes.core.k8s:
state: present state: present
@@ -207,7 +221,7 @@
values_template: ../templates/IngressValues.yml.jinja2 values_template: ../templates/IngressValues.yml.jinja2
load_balancer_name: "{{ variables.load_balancer_name }}" load_balancer_name: "{{ variables.load_balancer_name }}"
network_zone: "{{ variables.network_zone }}" network_zone: "{{ variables.network_zone }}"
certificate_name: "{{ certificate_name.value }}" certificate_name: "test"
ansible.builtin.template: ansible.builtin.template:
src: "{{ values_template }}" src: "{{ values_template }}"
dest: IngressValues.yml dest: IngressValues.yml