Installing Kubernetes with MicroK8s on an Intel NUC running Ubuntu

Get IT
3 min readJun 28, 2021
Photo: Ian Taylor via Unsplash

If you’re attempting to learn Kubernetes and Docker from the comfort of your own home you will likely run into a few issues that are not covered in the standard quick-start installation guides. I decided to use MicroK8s to get Kubernetes up and running on my own Intel NUC (not in the cloud). I ran into the following issue because I was setup to use WiFi in this process.

Note: Scroll down to “Setting Up the Environment” section if you’re simply looking to set this up for the first time.

Issue: Stuck in the “ContainerCreating” Status

Specifically, I’m referring to the pods stuck in the “ContainerCreating” status and a few cryptic error messages around calico. Ultimately, I found the solution here: Microk8s 1.19 not working on Ubuntu 20.04.1 · Issue #1554

You’ll see this issue if you’re using WiFi for your network and you see “ContainerCreating” status when running the following command:

microk8s kubectl get pods -A -w

Output

NAMESPACE   NAME                           READY STATUS
kube-system calico-kube-controllers--qghww 0/1 ContainerCreating

Potential Fix: Set network to use “wlo” (wireless)

Run ifconfig to see what network interfaces you have. You’ll likely see a “lo” and a “wlo” item in there. The following sets up Kubernetes to use WiFi for network interface.

(1) Update the cni.yaml file

sudo vi /var/snap/microk8s/current/args/cni-network/cni.yaml 

(2) Replace the value for IP_AUTODETECTION_METHOD (which has the default value: “first-found”) with the following updated value

- name: IP_AUTODETECTION_METHOD
value: "interface=wlo.*"

(3) Then, reapply the updated CNI manifest with the following command

microk8s kubectl apply -f /var/snap/microk8s/current/args/cni-network/cni.yaml

Why?

Why does the default “first-found” setting not find the “wlo” network interface on its own? Well, there is something in the auto-detection logic to ignore those with “lo” in them. And those of us using WiFi for our network are typical home user and DIY types. Most people will be using a hard-wired scenario that means “wlo” is not used as the network interface. I’m guessing that means most people don’t have this issue in the real world. 😔

Setting Up the Environment

If you’d like to see this issue first-hand, here are the steps: Purchase an Intel NUC, install Ubuntu 20.04, and then follow the MicroK8s installation guide. Some details and links below. Note that I’m using an affiliate link in some cases— that means if you follow a link and purchase on Amazon, I get a small commission. Thank you for your support. 😎

(1) Buy Intel NUC 11

  • I’m recommending the latest and greatest. This Intel NUC 11 i5 has lots of CPUs, is fast, quiet, has low-wattage and built-in graphics that will work for a gaming system. NOTE: The Intel NUC 11 machines are new for 2021 so if Amazon is out or too expensive, try buying from NewEgg.com.
  • Don’t forget to buy a few Memory Modules (DRAM) and fast NVMe storage

(2) Download Ubuntu ISO for 20.04

  • Download the ISO from here. Yes, it’s confusing that the file name is ‘ubuntu-20.04.2.0-desktop-amd64.ios’ — why the AMD? I thought this was Intel? Well, it just means 64-bit. This ISO file works fine on Intel CPUs.
  • Put this ISO file on a USB stick. Use the free Balena Etcher software to accomplish this.
  • Follow the Ubuntu install instructions. After install, do the ‘sudo snap refresh’ to update your software.

(3) Use “snap” to Install MicroK8s

  • Instructions here
  • I recommend using latest 1.21 version sudo snap install microk8s --classic --channel=1.21/stable
  • Ignore the part about firewall settings at the bottom (the 'ufw')
  • If you’re like me, you’ll run into the above issue on Step #4. Good luck!

After following the instructions to install MicroK8s, you’ll eventually see this issue. Return back to the top of this article for the fix. 👊

--

--

Get IT

Developer and IT Professional. Enjoy figuring out how to make things work. Big fan of all the code in Github.