I wanted to run Microk8s on a Proxmox 6 host inside of an LXC container. These are my notes from the journey.
- Create a privileged LXC container through the Proxmox web interface
- Enable nesting and FUSE
- In Proxmox UI, select container, then Options > Features > Check nesting and FUSE boxes
- SSH into the Proxmox host and edit the container's config in /etc/pve/lxc/.conf
- Add the following lines
- lxc.apparmor.profile: unconfined
- lxc.cap.drop:
- lxc.mount.auto: proc:rw sys:rw
- Add the following lines
- Start (or restart) the container
- SSH into the container and create a symlink for /dev/kmsg, which is missing in Ubuntu 19.10 containers
- ln -s /dev/console /dev/kmsg
- Has to be repeated on container reboot, which is annoying.
- Install snapd: apt install snapd
- Install microk8s: snap install microk8s --classic
The snap commands may need to be run more than once to get past errors.
If you get "cannot change profile for the next exec call: No such file or directory", try running: apparmor_parser -r /var/lib/snapd/apparmor/profiles/*
In Proxmox >7.0 (LXC container with Ubuntu 20.04.3 LTS) I had issue with below warning:
WARNING: The memory cgroup is not enabled. The cluster may not be functioning properly. Please ensure cgroups are enabled See for example: https://microk8s.io/docs/install-alternatives#heading--arm
In order to fix my issue I had to switch back from cgroupv2 to legacy solution.
Open shell of proxmox host and change GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub to below one
GRUB_CMDLINE_LINUX_DEFAULT="systemd.unified_cgroup_hierarchy=0 quiet"
then
update-grub && reboot
.Docs:
https://pve.proxmox.com/pve-docs/chapter-pct.html#pct_cgroup
https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#sysboot_edit_kernel_cmdline