image-builder: [Ubuntu] Cloud-init failing with KeyError: id0
What steps did you take and what happened:
with new ubuntu builds i am seeing cloud-init failing to assign networking with KeyError: id0
[2021-10-06 17:03:44] Cloud-init v. 21.3-1-g6803368d-0ubuntu1~20.04.3 running 'init-local' at Wed, 06 Oct 2021 17:03:44 +0000. Up 2.82 seconds.
[2021-10-06 17:03:44] 2021-10-06 17:03:44,289 - util.py[WARNING]: failed stage init-local
[2021-10-06 17:03:44] failed run of stage init-local
[2021-10-06 17:03:44] ------------------------------------------------------------
[2021-10-06 17:03:44] Traceback (most recent call last):
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 682, in status_wrapper
[2021-10-06 17:03:44] ret = functor(name, args)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 391, in main_init
[2021-10-06 17:03:44] init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 824, in apply_network_config
[2021-10-06 17:03:44] return self.distro.apply_network_config(
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 220, in apply_network_config
[2021-10-06 17:03:44] network_state = parse_net_config_data(netconfig)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 1074, in parse_net_config_data
[2021-10-06 17:03:44] nsi.parse_config(skip_broken=skip_broken)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 261, in parse_config
[2021-10-06 17:03:44] self.parse_config_v2(skip_broken=skip_broken)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 310, in parse_config_v2
[2021-10-06 17:03:44] self._v2_common(command)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 722, in _v2_common
[2021-10-06 17:03:44] self._handle_individual_nameserver(name_cmd, iface)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 91, in decorator
[2021-10-06 17:03:44] return func(self, command, *args, **kwargs)
[2021-10-06 17:03:44] File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 546, in _handle_individual_nameserver
[2021-10-06 17:03:44] _iface[iface]['dns'] = {'nameservers': nameservers, 'search': search}
[2021-10-06 17:03:44] KeyError: 'id0'
[2021-10-06 17:03:44] ------------------------------------------------------------
[2021-10-06 17:03:44] Cloud-init v. 21.3-1-g6803368d-0ubuntu1~20.04.3 running 'init' at Wed, 06 Oct 2021 17:03:44 +0000. Up 3.19 seconds.
metadata:
instance-id: "wlan-1-md-0-775d8846bf-9bfrd"
local-hostname: "wlan-1-md-0-775d8846bf-9bfrd"
wait-on-network:
ipv4: false
ipv6: false
network:
version: 2
ethernets:
id0:
match:
macaddress: "00:50:56:a1:d8:a7"
set-name: "eth0"
wakeonlan: true
addresses:
- "10.196.27.122/28"
gateway4: "10.196.27.126"
nameservers:
addresses:
- "10.102.102.132"
- "10.102.102.133"
- "10.90.24.1"
search:
- "refsa1.bn.schiff.telekom.de"
What did you expect to happen: Cloud init is working properly
Environment:
Project: CAPI
Additional info for Image Builder for Cluster API related issues:
- OS (e.g. from
/etc/os-release
, orcmd /c ver
): Ubuntu 2004
/kind bug [One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 36 (30 by maintainers)
Commits related to this issue
- Fix set-name/interface DNS bug This patch addresses an issue caused when the v2 network config directive "set-name" was used in conjunction with interface- specific DNS settings. The patch adds a tes... — committed to akutz/cloud-init by akutz 3 years ago
- Fix set-name/interface DNS bug (#1058) This patch addresses an issue caused when the v2 network config directive "set-name" was used in conjunction with interface- specific DNS settings. The patch ... — committed to canonical/cloud-init by akutz 3 years ago
- Downgrade cloud-init. Workaround for #712 — committed to kkeshavamurthy/image-builder by kkeshavamurthy 3 years ago
- Downgrade cloud-init. Workaround for #712 — committed to kkeshavamurthy/image-builder by kkeshavamurthy 3 years ago
- Merge pull request #728 from kkeshavamurthy/kk-cloudinit-21.1 Downgrade cloud-init. Workaround for #712 — committed to kubernetes-sigs/image-builder by k8s-ci-robot 3 years ago
Cloud-Init engineers have merged the fix (https://github.com/canonical/cloud-init/pull/1058). I am unclear when it will make its way into the update channel.
I fixed the issue introduced in https://github.com/canonical/cloud-init/commit/abd2da5777195e7e432b0d53a3f7f29d071dd50e with the following patch:
The tests now run fine:
I will file a bug in Launchpad tomorrow and submit a PR to Cloud-Init with the fix.
or https://github.com/kubernetes-sigs/image-builder/blob/master/images/capi/ansible/roles/setup/tasks/debian.yml#L51, which does a dist upgrade. That should also yield 20.04.3