2026-04-22 03:02:13 +00:00
|
|
|
---
|
2026-04-23 03:55:52 +00:00
|
|
|
- name: Pre-pull kube-vip bootstrap images into containerd
|
|
|
|
|
command: /usr/local/bin/ctr -n k8s.io images pull {{ item }}
|
|
|
|
|
register: kube_vip_image_pull
|
|
|
|
|
retries: 12
|
|
|
|
|
delay: 15
|
|
|
|
|
until: kube_vip_image_pull.rc == 0
|
|
|
|
|
loop: "{{ kube_vip_prepull_images }}"
|
|
|
|
|
changed_when: true
|
|
|
|
|
|
2026-04-22 03:02:13 +00:00
|
|
|
- name: Render kube-vip control plane manifest
|
|
|
|
|
template:
|
|
|
|
|
src: kube-vip-control-plane.yaml.j2
|
|
|
|
|
dest: /tmp/kube-vip-control-plane.yaml
|
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
|
|
- name: Apply kube-vip control plane manifest
|
|
|
|
|
command: kubectl apply -f /tmp/kube-vip-control-plane.yaml
|
|
|
|
|
changed_when: true
|
|
|
|
|
|
2026-04-22 04:29:29 +00:00
|
|
|
- name: Wait for local kube-vip pod to be ready
|
2026-04-22 04:41:48 +00:00
|
|
|
shell: >-
|
2026-04-22 04:29:29 +00:00
|
|
|
kubectl -n kube-system get pods
|
|
|
|
|
-l app.kubernetes.io/name=kube-vip
|
|
|
|
|
--field-selector spec.nodeName={{ inventory_hostname }}
|
2026-04-22 04:41:48 +00:00
|
|
|
-o jsonpath='{.items[0].status.conditions[?(@.type=="Ready")].status}'
|
2026-04-22 04:29:29 +00:00
|
|
|
register: kube_vip_pod_ready
|
2026-04-22 03:02:13 +00:00
|
|
|
changed_when: false
|
2026-04-22 04:29:29 +00:00
|
|
|
until: kube_vip_pod_ready.stdout == "True"
|
2026-04-23 03:55:52 +00:00
|
|
|
retries: 30
|
2026-04-22 04:29:29 +00:00
|
|
|
delay: 10
|
2026-04-22 03:02:13 +00:00
|
|
|
|
2026-04-23 03:55:52 +00:00
|
|
|
- name: Show kube-vip pod status on failure
|
|
|
|
|
command: kubectl -n kube-system get pods -l app.kubernetes.io/name=kube-vip -o wide
|
|
|
|
|
register: kube_vip_pods
|
|
|
|
|
changed_when: false
|
|
|
|
|
failed_when: false
|
|
|
|
|
when: kube_vip_pod_ready is failed
|
|
|
|
|
|
|
|
|
|
- name: Describe kube-vip pod on failure
|
|
|
|
|
shell: >-
|
|
|
|
|
kubectl -n kube-system describe pod
|
|
|
|
|
$(kubectl -n kube-system get pods -l app.kubernetes.io/name=kube-vip --field-selector spec.nodeName={{ inventory_hostname }} -o jsonpath='{.items[0].metadata.name}')
|
|
|
|
|
register: kube_vip_pod_describe
|
|
|
|
|
changed_when: false
|
|
|
|
|
failed_when: false
|
|
|
|
|
when: kube_vip_pod_ready is failed
|
|
|
|
|
|
|
|
|
|
- name: Fail with kube-vip diagnostics
|
|
|
|
|
fail:
|
|
|
|
|
msg: |
|
|
|
|
|
kube-vip failed to become ready on {{ inventory_hostname }}.
|
|
|
|
|
Pods:
|
|
|
|
|
{{ kube_vip_pods.stdout | default('n/a') }}
|
|
|
|
|
|
|
|
|
|
Describe:
|
|
|
|
|
{{ kube_vip_pod_describe.stdout | default('n/a') }}
|
|
|
|
|
when: kube_vip_pod_ready is failed
|
|
|
|
|
|
2026-04-22 03:02:13 +00:00
|
|
|
- name: Wait for API VIP on 6443
|
|
|
|
|
wait_for:
|
|
|
|
|
host: "{{ kube_vip_address }}"
|
|
|
|
|
port: 6443
|
|
|
|
|
state: started
|
|
|
|
|
timeout: 180
|