Skip to content

Instantly share code, notes, and snippets.

@michael-pisman
Forked from acj/microk8s_in_lxc.md
Last active June 11, 2023 09:07
Show Gist options
  • Save michael-pisman/b670a6a79226e4c1ab65b7a0faec3f9d to your computer and use it in GitHub Desktop.
Save michael-pisman/b670a6a79226e4c1ab65b7a0faec3f9d to your computer and use it in GitHub Desktop.
Installing microk8s in an LXC container

Installing microk8s in an LXC container

I wanted to run Microk8s on a Proxmox 6 host inside of an LXC container. These are my notes from the journey.

  1. 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
  1. 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
  2. Start (or restart) the container

  3. 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

    $ vi /etc/rc.local

    #!/bin/bash
    ln -s /dev/console /dev/kmsg
    
  4. Install snapd: apt install snapd

  5. Install microk8s: snap install microk8s --classic

The snap commands may need to be run more than once to get past errors.

Troubleshooting

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/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment