UNCLASSIFIED - NO CUI

Skip to content

Resolve "k3d-dev.sh not running userdata"

Zach Callahan requested to merge 2398-k3d-dev-sh-not-running-userdata into master

k3d-dev.sh fixes

This MR resolves a few lingering issues with the k3d-dev.sh script.

Issues

Cloud Init Failure

The cloud-init script provided in the ec2 user data wasn't being executed correctly. I simplified the script and removed the multipart delineations (since we're not using actual cloud-init in combo with a script).

Before

On the remote:

> cat /var/log/cloud-init-output.log
...
2024-10-30 18:26:55,033 - handlers[WARNING]: Unhandled unknown content-type (text/plain) userdata: 'b'  --==MYBOUNDARY=='...'
...
Cloud-init v. 24.3.1-0ubuntu0~22.04.1 running 'modules:final' at Fri, 01 Nov 2024 14:24:39 +0000. Up 17.83 seconds.
-- THERE SHOULD BE OUTPUT HERE BUT THERE ISN'T --
Cloud-init v. 24.3.1-0ubuntu0~22.04.1 finished at Fri, 01 Nov 2024 14:24:39 +0000. Datasource DataSourceEc2Local.  Up 17.98 seconds

After

Cloud-init v. 24.3.1-0ubuntu0~22.04.1 running 'modules:final' at Fri, 01 Nov 2024 14:37:33 +0000. Up 32.90 seconds.
* Applying /etc/sysctl.d/10-console-messages.conf ...
kernel.printk = 4 4 1 7
* Applying /etc/sysctl.d/10-ipv6-privacy.conf ...
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2
* Applying /etc/sysctl.d/10-kernel-hardening.conf ...
kernel.kptr_restrict = 1
* Applying /etc/sysctl.d/10-magic-sysrq.conf ...
kernel.sysrq = 176
* Applying /etc/sysctl.d/10-network-security.conf ...
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.all.rp_filter = 2
* Applying /etc/sysctl.d/10-ptrace.conf ...
kernel.yama.ptrace_scope = 1
* Applying /etc/sysctl.d/10-zeropage.conf ...
vm.mmap_min_addr = 65536
* Applying /etc/sysctl.d/50-cloudimg-settings.conf ...
net.ipv4.neigh.default.gc_thresh2 = 15360
net.ipv4.neigh.default.gc_thresh3 = 16384
net.netfilter.nf_conntrack_max = 1048576
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.default.accept_source_route = 0
sysctl: setting key "net.ipv4.conf.all.accept_source_route": Invalid argument
net.ipv4.conf.default.promote_secondaries = 1
sysctl: setting key "net.ipv4.conf.all.promote_secondaries": Invalid argument
net.ipv4.ping_group_range = 0 2147483647
net.core.default_qdisc = fq_codel
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
fs.protected_regular = 1
fs.protected_fifos = 1
* Applying /usr/lib/sysctl.d/50-pid-max.conf ...
kernel.pid_max = 4194304
* Applying /etc/sysctl.d/99-cloudimg-ipv6.conf ...
net.ipv6.conf.all.use_tempaddr = 0
net.ipv6.conf.default.use_tempaddr = 0
* Applying /usr/lib/sysctl.d/99-protect-links.conf ...
fs.protected_fifos = 1
fs.protected_hardlinks = 1
fs.protected_regular = 2
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.d/fs-file-max.conf ...
fs.file-max = 13181250
* Applying /etc/sysctl.d/fs-inotify-max_user_instances.conf ...
fs.inotify.max_user_instances = 1024
* Applying /etc/sysctl.d/fs-inotify-max_user_watches.conf ...
fs.inotify.max_user_watches = 1048576
* Applying /etc/sysctl.d/fs-may_detach_mounts.conf ...
* Applying /etc/sysctl.d/fs-nr_open.conf ...
fs.nr_open = 13181252
* Applying /etc/sysctl.d/vm-max_map_count.conf ...
vm.max_map_count = 524288
* Applying /etc/sysctl.conf ...
Cloud-init v. 24.3.1-0ubuntu0~22.04.1 finished at Fri, 01 Nov 2024 14:37:34 +0000. Datasource DataSourceEc2Local.  Up 33.17 seconds

MetalLB Initialization Failure

The heredoc within a heredoc pattern was acting unreliably when attempting to create configuration files on the remote host. I simplified the process by creating the files with a heredoc on the local host and scping those up to the remote.

Before

Seen during script with the -a flag:

-bash: line 59: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
-bash: line 7: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
-bash: line 7: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
97ab9b81dd6cc120137ebacc0975f2ae6cb91876c094c9479c505e9c2ce18d8c
eb34d205bfa8ebbc656596db5324f074578c435c2c439003ef813d72e07b2515
error: error parsing metallb-config.yaml: error converting YAML to JSON: yaml: line 2: mapping values are not allowed in this context

NOTE: MOTDs removed for brevity

After

primary-proxy.yaml          100%   73     1.0KB/s   00:00
secondary-proxy.yaml        100%   73     1.0KB/s   00:00
3aaa71aa2e100152554b5256c87e3290537a6475d318a6fec362faae1d69acb4
3aad49d976361432e1b33214baa0b8a626e4f56982c6733a7b34772885624ab6
metallb-config.yaml         100% 1130    15.7KB/s   00:00
ipaddresspool.metallb.io/primary created
ipaddresspool.metallb.io/secondary created
l2advertisement.metallb.io/primary created
l2advertisement.metallb.io/secondary created

Please verify this works correctly with your preferred switches. I've tested with -m, -a, and with no arguments.

Upgrade Notices

N/A

Closes #2398 (closed)

Edited by Zach Callahan

Merge request reports

Loading