Troubleshooting Common Issues in Canonical Microk8s
  • 28-Dec-2022
Lightrun Team
Author Lightrun Team
Share
Troubleshooting Common Issues in Canonical Microk8s

Troubleshooting Common Issues in Canonical Microk8s

Lightrun Team
Lightrun Team
28-Dec-2022

Project Description

Canonical MicroK8s is a lightweight, fast, and secure Kubernetes distribution that is fully supported by Canonical, the company behind the Ubuntu operating system. It is designed to be easy to install and use, and can be deployed on a wide range of hardware and cloud platforms.

MicroK8s is a fully compliant Kubernetes distribution and includes all of the components and features that you would find in a standard Kubernetes deployment. It includes support for multiple nodes, automatic updates, and the ability to run in high availability mode.

One of the main benefits of MicroK8s is that it is designed to be lightweight and easy to use, making it an ideal choice for developers who want to get started with Kubernetes quickly and easily. It is also well-suited for edge computing and IoT applications, where a smaller, more efficient Kubernetes deployment may be preferred.

Troubleshooting Canonical Microk8s with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

The following issues are the most popular issues regarding this project:

The connection to the server 127.0.0.1:16443 was refused – did you specify the right host or port?

By executing the command “sudo microk8s refresh-certs”, a successful rejuvenation of resources has been achieved.

The memory cgroup is not enabled.

To enhance your Ubuntu 22.04 experience, here is a simple fix you can do to enable better memory management: Open the /etc/default/grub file and adjust its GRUB_CMDLINE_LINUX string by adding ‘cgroup-enable=memory cgroup-memory=1‘. Save this change then run sudo update-grub for it to take effect – as shown in the example grub file given!

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="cgroup_enable=memory cgroup_memory=1 swapaccount=1 systemd.unified_cgroup_hierarchy=0"

With your computer restarted, run the microk8s.inspect command and you should be off to a good start! The current version of MicroK8s is v1.25.2 revision 4055 for anyone who’s keeping track – it’ll open up more possibilities than ever before!

microk8s is not running. microk8s.inspect showing no error

I encountered a resolution to my issue with microk8s: after uninstalling the pre-existing kubectl, I was able to get it back up and running.

rm -rf /usr/local/bin/kubectl

calicp-kube-controllers can’t get API Server: context deadline exceeded

In order to ensure that ‘br_netfilter’ is loaded at boot time, edit the ‘/etc/modules’ file and add a new line. To stop MicroK8s services run the command ‘sudo microk8s stop’. Subsequently remove any message regarding the ‘–proxy-mode’, from within ‘/var/snap/microk8s/current//args/kube-proxy’. Finally load in br_netfilter by running sudo modprobe ‘br_netfilter’, followed by another call of `sudo microks start` to initiate all required services.

Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.