kubernetes-sigs / kubespray

Deploy a Production Ready Kubernetes Cluster
Apache License 2.0
15.95k stars 6.42k forks source link

Error adding node #11125

Open powerdu91 opened 5 months ago

powerdu91 commented 5 months ago

What happened?

servername IP hardware role
k8s-master01 192.168.202.130/24 4C4G40G master
k8s-master02 192.168.202.131/24 4C4G40G master
k8s-master03 192.168.202.132/24 4C4G40G master
k8s-woker01 192.168.202.133/24 4C4G40G worker
k8s-woker02 192.168.202.134/24 4C4G40G worker
kubespray 192.168.202.135/24 4C4G40G ansible

I successfully created the k8s cluster and then deleted node node5. The command is: Ansible playbook - i inventory/cluster/hosts. yaml -- come -- come user=root remove node. yml - v - b -- extra vars "node=node5". Afterwards, I added node5 node and the command was: Ansible playbook - i inventory/cluster/hosts. yaml -- come -- come user=root scale. yml - v - b -- limit=node5 Errors that occurred:

The conditional check 'download.enabled' failed. The error was: error while evaluating conditional (download.enabled): {{ download_defaults | combine(item.value) }}: 'item' is undefined. 'item' is undefined. {{ download_defaults | combine(item.value) }}: 'item' is undefined. 'item' is undefined

The error appears to be in '/root/kubespray/roles/download/tasks/main.yml': line 19, column 3, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

TASK [download : Download | Download files / images]

What did you expect to happen?

Under normal circumstances, a new node will be successfully added

How can we reproduce it (as minimally and precisely as possible)?

ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root scale.yml -v -b --limit=node5

OS

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

Version of Ansible

ansible [core 2.16.6] config file = /root/kubespray/ansible.cfg configured module search path = ['/root/kubespray/library'] ansible python module location = /usr/local/python3.10.4/lib/python3.10/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/python3.10.4/bin/ansible python version = 3.10.4 (main, Apr 23 2024, 16:17:03) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] (/usr/local/python3.10.4/bin/python3) jinja version = 3.1.2 libyaml = True

Version of Python

Python 3.10.4

Version of Kubespray (commit)

ab0ef18

Network plugin used

calico

Full inventory with variables

result.txt

Command used to invoke ansible

ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root scale.yml -v -b --limit=node5

Output of ansible run

TASK [download : Prep_download | Set a few facts] ** ok: [node5] => {"ansible_facts": {"download_force_cache": false}, "changed": false} Thursday 25 April 2024 20:00:19 +0800 (0:00:01.517) 0:03:32.813 **** Thursday 25 April 2024 20:00:19 +0800 (0:00:00.106) 0:03:32.919 **** Thursday 25 April 2024 20:00:19 +0800 (0:00:00.098) 0:03:33.018 **** Thursday 25 April 2024 20:00:19 +0800 (0:00:00.080) 0:03:33.099 **** Thursday 25 April 2024 20:00:19 +0800 (0:00:00.205) 0:03:33.304 ****

TASK [download : Prep_download | Register docker images info] ** ok: [node5] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false} Thursday 25 April 2024 20:00:23 +0800 (0:00:03.221) 0:03:36.526 ****

TASK [download : Prep_download | Create staging directory on remote node] ** ok: [node5] => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/tmp/releases/images", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size": 6, "state": "directory", "uid": 0} Thursday 25 April 2024 20:00:24 +0800 (0:00:00.887) 0:03:37.413 **** Thursday 25 April 2024 20:00:24 +0800 (0:00:00.075) 0:03:37.489 **** Thursday 25 April 2024 20:00:24 +0800 (0:00:00.071) 0:03:37.561 **** The conditional check 'download.enabled' failed. The error was: error while evaluating conditional (download.enabled): {{ download_defaults | combine(item.value) }}: 'item' is undefined. 'item' is undefined. {{ download_defaults | combine(item.value) }}: 'item' is undefined. 'item' is undefined

The error appears to be in '/root/kubespray/roles/download/tasks/main.yml': line 19, column 3, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

TASK [download : Download | Download files / images] *** fatal: [node5]: FAILED! => {"msg": "{{ skip_kubeadm_images | ternary({}, _kubeadm_images) }}: {{ dict(names | map('regexreplace', '^(.*)', 'kubeadm\1') | zip( repos | zip(_tags, _groups) | map('zip', keys) | map('map', 'reverse') | map('community.general.dict') | map('combine', defaults))) | dict2items | rejectattr('key', 'in', excluded) | items2dict }}: {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ dict(names | map('regexreplace', '^(.*)', 'kubeadm\1') | zip( repos | zip(_tags, _groups) | map('zip', keys) | map('map', 'reverse') | map('community.general.dict') | map('combine', defaults))) | dict2items | rejectattr('key', 'in', excluded) | items2dict }}: {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ skip_kubeadm_images | ternary({}, _kubeadm_images) }}: {{ dict(names | map('regexreplace', '^(.*)', 'kubeadm\1') | zip( repos | zip(_tags, _groups) | map('zip', keys) | map('map', 'reverse') | map('community.general.dict') | map('combine', defaults))) | dict2items | rejectattr('key', 'in', excluded) | items2dict }}: {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ dict(names | map('regexreplace', '^(.*)', 'kubeadm\1') | zip( repos | zip(_tags, _groups) | map('zip', keys) | map('map', 'reverse') | map('community.general.dict') | map('combine', defaults))) | dict2items | rejectattr('key', 'in', excluded) | items2dict }}: {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ repos | map('split', '/') | map(attribute=-1) }}: {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ images | map(attribute=0) }}: {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined. {{ kubeadm_images_raw.stdout_lines | map('split', ':') }}: 'kubeadm_images_raw' is undefined. 'kubeadm_images_raw' is undefined"}

NO MORE HOSTS LEFT *****

PLAY RECAP ***** node5 : ok=183 changed=3 unreachable=0 failed=1 skipped=292 rescued=0 ignored=0

Thursday 25 April 2024 20:00:25 +0800 (0:00:01.052) 0:03:38.613 **** =============================================================================== container-engine/containerd : Download_file | Download item ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 15.46s container-engine/containerd : Containerd | Unpack containerd archive --------------------------------------------------------------------------------------------------------------------------------------------------------------- 11.45s container-engine/nerdctl : Download_file | Download item --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10.24s container-engine/containerd : Containerd | Write base_runtime_specs ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 8.94s container-engine/crictl : Download_file | Download item ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7.67s container-engine/runc : Download_file | Download item ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7.61s container-engine/crictl : Extract_file | Unpacking archive -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7.34s container-engine/nerdctl : Extract_file | Unpacking archive ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.52s container-engine/containerd : Containerd | Copy containerd config file -------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.57s container-engine/containerd : Download_file | Create dest directory on node --------------------------------------------------------------------------------------------------------------------------------------------------------- 3.48s container-engine/containerd : Containerd | Remove orphaned binary ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.23s download : Prep_download | Register docker images info ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3.22s container-engine/containerd : Containerd | Ensure containerd directories exist ------------------------------------------------------------------------------------------------------------------------------------------------------ 3.08s container-engine/containerd : Prep_download | Set a few facts ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.83s container-engine/nerdctl : Download_file | Create dest directory on node ------------------------------------------------------------------------------------------------------------------------------------------------------------ 2.38s container-engine/crictl : Download_file | Create dest directory on node ------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.38s container-engine/runc : Download_file | Create dest directory on node --------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.35s kubernetes/preinstall : Check existence of /etc/resolvconf/resolv.conf.d ------------------------------------------------------------------------------------------------------------------------------------------------------------ 2.35s container-engine/cri-dockerd : Generate cri-dockerd systemd unit files -------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.16s kubernetes/preinstall : Set selinux policy ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1.91s

Anything else we need to know

No response

powerdu91 commented 5 months ago

20240426161123

ErikJiang commented 4 months ago

perhaps you need to wait until this PR is merged before trying again.

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 4 weeks ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten