Every time I find myself touching this issue, I always find myself spending hours never getting this to work. Which is odd to me as I have less trouble with cloud-init on other systems, it mostly just work OOTB.
Today, I had to quickly write up a bash script and test it. Then I attempted to launch a container using these parameters:
lxc launch local:centos7 centos7-dev --profile default < /tmp/config.yml
The fingerprint of image is: 0d0f0af9dc3f
Here is a copy of config.yml
config:
user.network-config: |
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
ipv4: true
address: 192.168.103.13
netmask: 255.255.255.0
gateway: 192.168.103.1
control: auto
- type: nameserver
address: 192.168.99.1
A copy of the container config:
architecture: x86_64
config:
image.architecture: amd64
image.description: Centos 7 amd64 (20210313_07:08)
image.os: Centos
image.release: "7"
image.serial: "20210313_07:08"
image.type: squashfs
image.variant: cloud
user.network-config: |
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
ipv4: true
address: 192.168.103.13
netmask: 255.255.255.0
gateway: 192.168.103.1
control: auto
- type: nameserver
address: 192.168.99.1
volatile.base_image: 0d0f0af9dc3f4d8fce76797c9d592789bba511e8365bcd0aa3796d50c5d7d55d
volatile.eth0.host_name: veth2bf3443c
volatile.eth0.hwaddr: 00:16:3e:95:59:0b
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: RUNNING
volatile.uuid: 741d93ea-ac56-413f-a463-f9e99add5552
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""
Instead of the container being assigned the static IP I’ve set above, get it’s IP from DHCP, obviously not the behavior I was expecting. Doing everything I’m suppose to do in Custom Network Configuration with cloud-init. There is no /var/lib/cloud/seed/nocloud-net/network-config
?
Full cloud-init log here: https://l.lhputils.info/GROUJ
Additionally, upon reviewing the logs, disturbingly openssh server
isn’t installed by default on CentOS 7
cloud image which now requires me to add additional configuration options to cloud-init.
Is this suppose to be a simple process, am I misunderstanding the methodology here?
Host OS: OpenSUSE Tumbleweed
LXD Snap: server_version: "4.12"