<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nuno do Carmo</title>
    <description>The latest articles on Forem by Nuno do Carmo (@nunix).</description>
    <link>https://forem.com/nunix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1094264%2F54518c77-876d-4a4e-8c00-9c69b190a858.png</url>
      <title>Forem: Nuno do Carmo</title>
      <link>https://forem.com/nunix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nunix"/>
    <language>en</language>
    <item>
      <title>Portainer: deploying MicroK8s</title>
      <dc:creator>Nuno do Carmo</dc:creator>
      <pubDate>Thu, 06 Jul 2023 16:46:31 +0000</pubDate>
      <link>https://forem.com/nunix/portainer-deploying-microk8s-49bd</link>
      <guid>https://forem.com/nunix/portainer-deploying-microk8s-49bd</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Some weeks ago, I published a blog post as an answer to another blog about Rancher manager requirements.&lt;/p&gt;

&lt;p&gt;However, one of the collateral impact of the original blog post was an unwanted publicity to another great project: Portainer.io&lt;/p&gt;

&lt;p&gt;Their team has contacted me and we've been talking since then. They were simply 5⭐ on their response and on their DMs.&lt;/p&gt;

&lt;p&gt;I told them how much I appreciated their project and that I fully understood they had no part on the initial blog post. And while we were discussing, they told me that they were launching a new feature: deploy a MicroK8s node directly from Portainer.&lt;/p&gt;

&lt;p&gt;As said in the previous blog post, for anyone following me since some time, they do know my big appreciation for MicroK8s and the team at Canonical.&lt;/p&gt;

&lt;p&gt;It was a certitude that I would test it and blog about how to use it on WSL2.&lt;/p&gt;

&lt;p&gt;So without further due, let's see how Portainer and MicroK8s might be one of the greatest match that might go a bit unnoticed! (&lt;em&gt;note: this is purely my personal opinion&lt;/em&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Here’s the list of components I used for this blog post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;OS: Windows 11 Professional version 23H2 - channel: Insiders canary / build: 25393&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;WSL2 distro: &lt;a href="https://apps.microsoft.com/store/detail/ubuntu/9PDXGNCFSCZV"&gt;Ubuntu 22.04&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Since &lt;a href="https://github.com/microsoft/WSL/releases/tag/0.67.6"&gt;WSL v0.67.6&lt;/a&gt;, systemD can be enabled in &lt;code&gt;/etc/wsl.conf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Since &lt;a href="[Release%201.3.10%20%C2%B7%20microsoft/WSL%20(github.com)](https://github.com/microsoft/WSL/releases/tag/1.3.10)"&gt;WSL v1.3.10&lt;/a&gt;, cgroups v2 can be used without a direct impact on containers use cases&lt;/li&gt;
&lt;li&gt;To enable cgroups v2, here's changes in both WSL configuration files
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="c"&gt;# Windows filesystem: $env:USERPROFILE\.wslconfig&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;wsl2]
  kernelCommandLine &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;cgroup_no_v1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;all systemd.unified_cgroup_hierarchy&lt;span class="o"&gt;=&lt;/span&gt;1

  &lt;span class="c"&gt;# Linux distro filesystem: /etc/wsl.conf&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;boot]
  &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'umount /sys/fs/cgroup/unified &amp;amp;&amp;amp; umount /sys/fs/cgroup/systemd &amp;amp;&amp;amp; umount /sys/fs/cgroup; mount -t cgroup2 cgroup2 /sys/fs/cgroup -o rw,nosuid,nodev,noexec,relatime,nsdelegate'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;The distro hostname has been changed in &lt;code&gt;/etc/wsl.conf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Port forwarding has been disabled in &lt;code&gt;$env:USERPROFILE\.wslconfig&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Docker: Docker Desktop (for Windows)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version: 4.21.0 (113844)&lt;/li&gt;
&lt;li&gt;Docker socket shared with the distro: Settings &amp;gt; Resources &amp;gt; WSL integration&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SSH keys are generated&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;[Optional] Terminal Preview: &lt;a href="https://apps.microsoft.com/store/detail/windows-terminal-preview/9N8G5RFZ9XK3"&gt;Windows Terminal&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version: 1.18.1462.0&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deploying Portainer as a Windows container
&lt;/h2&gt;

&lt;p&gt;First thing first, yes the title of this chapter is correct, not a typo.&lt;/p&gt;

&lt;p&gt;Secondly, you could ask: why? In addition to the usual "because I can", the goal here is to show the long history of Portainer with the containers world and "back in the days", the idea of Windows containers was somehow talked about quite often.&lt;/p&gt;

&lt;p&gt;And if the talks are less and less present today, the fact that Portainer continues to have a Windows container solution, shows their commitment to their project as open as possible in terms of backend technologies.&lt;/p&gt;

&lt;p&gt;Finally, this will allow to have a solution working fully on your machine without any Virtual Machines involved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Portainer Business Edition license
&lt;/h3&gt;

&lt;p&gt;The feature of deploying a MicroK8s cluster is part of the Portainer Business Edition, and not the community one.&lt;/p&gt;

&lt;p&gt;Before anyone jumps into conclusions how bad this is or could be, let me say that I fully approve the monetization of features that are more targeted at companies rather than community overall.&lt;/p&gt;

&lt;p&gt;And to ensure the paywall doesn't feel as hard as "if you don't pay, you cannot try/use the features", Portainer provides a "free tier" for testing purpose with few licenses.&lt;/p&gt;

&lt;p&gt;To obtain your free tier Business Edition, go to Portainer.io and click on the &lt;code&gt;Get Started Free&lt;/code&gt; button. Fill up the form and you'll receive an email with the license. Keep it handy, as we'll need it once we deployed the Portainer container.&lt;/p&gt;

&lt;h3&gt;
  
  
  Starting Portainer
&lt;/h3&gt;

&lt;p&gt;The full documentation on deploying Portainer Business Edition can be found &lt;a href="https://docs.portainer.io/start/install/server/docker/wcs"&gt;on their docs site&lt;/a&gt; or their &lt;a href="https://academy.portainer.io/install/#/"&gt;academy site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The step by step approach is a real good way to learn, so it's strongly advised you go through the docs or academy at least once and see the different options.&lt;/p&gt;

&lt;p&gt;For this blog post, in order to avoid duplicated docs, only the final command will be shared:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check which Docker daemon is running&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'{{json .Server.Os}}'&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# [Optional] Switch the Docker daemon to Windows Containers&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'C:\Program Files\Docker\Docker\DockerCli'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-SwitchDaemon&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Create a volume, needed by Portainer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;volume&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;portainer_data&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Start the Portainer Windows container&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;8000:8000&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;9443:9443&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;portainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;always&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-v&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;\\.\pipe\docker_engine:\\.\pipe\docker_engine&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-v&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;portainer_data:C:\data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;portainer/portainer-ee:latest&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# [Optional] Check if the container is running&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ps&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eqM8iiKd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aekuzdk4p767c6jptugx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eqM8iiKd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aekuzdk4p767c6jptugx.png" alt="Create a new Portainer Windows container" width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;**NOTE:&lt;/em&gt;* the Docker daemon can be switched from Docker Desktop tray icon too.*&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the container is running, you can access Portainer web interface on &lt;a href="https://localhost:9443"&gt;https://localhost:9443&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eDjl8Ell--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2uerlc070xmlx8sklz26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eDjl8Ell--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2uerlc070xmlx8sklz26.png" alt="Portainer first login welcome page" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;**NOTE:&lt;/em&gt;* you'll get a certificate warning as the web site is using a self-signed certificate. You can trust it and will be able to see the page above.*&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From here, follow the &lt;a href=""&gt;Portainer docs&lt;/a&gt; to setup your user, enter your license, optionally add the current Docker instance as your first environment and finally see Portainer's management page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CKSAUdwS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efuqss05xquslfvzt684.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CKSAUdwS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efuqss05xquslfvzt684.png" alt="Portainer management page with the first environment" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You're now ready to deploy a brand new MicroK8s cluster from Portainer!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying MicroK8s
&lt;/h2&gt;

&lt;p&gt;Before you go ahead, please note that this section if fully described in Portainers docs on &lt;a href="https://docs.portainer.io/admin/environments/add/kube-create/microk8s"&gt;how to deploy MicroK8s&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If it already exists, then why "duplicating it", you might ask? Well, as said above, I hate duplicating docs indeed, however the setup used, Windows containers + WSL2 target, is not covered. Which is totally fine as it might be a very edge-y case anyways. And, you'll see later, in order to make the whole environment work as intended, there's some need of Windows network configuration.&lt;/p&gt;

&lt;p&gt;But I don't want to spoil it for you, so let's tackle this last section step by step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create new SSH credentials
&lt;/h3&gt;

&lt;p&gt;As written in the docs, you'll need to use SSH to connect to the host where you want to deploy MicroK8s.&lt;/p&gt;

&lt;p&gt;In Portainer, you'll need to create a new &lt;code&gt;Shared Credential&lt;/code&gt; before the creation of a new environment.&lt;/p&gt;

&lt;p&gt;Once again, to avoid docs duplication, you can refer to Portainer docs on how to &lt;a href="https://docs.portainer.io/admin/settings/credentials/ssh"&gt;add SSH credentials&lt;/a&gt; for all the details. And here's the quick steps to do it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;code&gt;Settings&lt;/code&gt; in the left menu to expand it and click on &lt;code&gt;Shared Credentials&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;+ Add credentials&lt;/code&gt; button in the top right of the main page&lt;/li&gt;
&lt;li&gt;Click on the &lt;code&gt;SSH&lt;/code&gt; card to select it&lt;/li&gt;
&lt;li&gt;Fill all requested fields in the &lt;code&gt;Credential details&lt;/code&gt; section

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Warning:&lt;/strong&gt; ensure that the SSH key you'll use is also added to the &lt;code&gt;$HOME/.ssh/authorized_keys&lt;/code&gt; file in your WSL2 distro!&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Add credentials&lt;/code&gt; at the bottom of the main page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the credentials created, you can continue onto the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create a new environment
&lt;/h3&gt;

&lt;p&gt;Go to the Portainer management page and perform the following actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;code&gt;Environments&lt;/code&gt; in the left menu&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;+ Add environment&lt;/code&gt; button in the top right of the main page&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Create a Kubernetes cluster&lt;/code&gt; card under the &lt;code&gt;Set up new environments&lt;/code&gt; section&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Start Wizard&lt;/code&gt; at the bottom of the main page&lt;/li&gt;
&lt;li&gt;Provide a name to your new cluster

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Example:&lt;/em&gt; wslmicrok8s&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Select the correct credentials

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Info:&lt;/em&gt; if there's only one credential, it will be selected by default&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Enter the WSL2 IP and click on &lt;code&gt;Test connections&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Info:&lt;/em&gt; you can get the IP from your distro with the command &lt;code&gt;hostname -I | cut -f1 -d' '&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this stage, you should see a connection timeout error. Jump into the next smaller step to fix it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2.1: It's all about networking&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is normal as the networks used by Docker Desktop for the Windows containers and WSL2 are explicitly separated. So all this work to end up here?&lt;/p&gt;

&lt;p&gt;Well, no, thankfully this issue is similar to another one which was resolved few years ago by a &lt;a href="https://techcommunity.microsoft.com/t5/itops-talk-blog/windows-subsystem-for-linux-2-addressing-traffic-routing-issues/ba-p/1764074"&gt;WSL2 community member&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's resolve the issue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check which network the Portainer container is using&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;## The command below assumes the container name is "portainer"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ls&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--filter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;docker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;inspect&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;portainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'{{ range.NetworkSettings.Networks}}{{.NetworkID}}{{end}}'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Enable the Docker and WSL networks to communicate&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;## The command below assumes the Docker network name is "nat"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;powershell.exe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'Get-NetIPInterface | where {$_.InterfaceAlias -eq "vEthernet (WSL)" -or $_.InterfaceAlias -eq "vEthernet (nat)" } | Set-NetIPInterface -Forwarding Enabled'&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BrZF7P6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfko6l3cfobmof2a8u58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BrZF7P6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfko6l3cfobmof2a8u58.png" alt="Image description" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you ran the command to connect both networks, you can go back to the Portainer management page and click on &lt;code&gt;Test connections&lt;/code&gt; again.&lt;/p&gt;

&lt;p&gt;This time, you should get a successful message stating the node is reachable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Provisioning the new environment
&lt;/h3&gt;

&lt;p&gt;The last options of the environment are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pick a Kubernetes version&lt;/li&gt;
&lt;li&gt;Select additional MicroK8s &lt;code&gt;Addons&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;With all the mandatory fields filled, you can click on &lt;code&gt;+ Provision environment&lt;/code&gt; at the bottom of the main page&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Close&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You'll be redirected to the &lt;code&gt;Environments&lt;/code&gt; page and you'll see under the &lt;code&gt;URL&lt;/code&gt; column, all the different provisioning stages.&lt;/p&gt;

&lt;p&gt;The provisioning should take few minutes and once completed, you can click on the environment name to see its details.&lt;/p&gt;

&lt;p&gt;But what you might really want, is to see the MicroK8s cluster content, so click on &lt;code&gt;Home&lt;/code&gt; at the top of the left menu, and you should see a line with your new cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gjy5HqS7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2c2qx7fu4p92j62ksx9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gjy5HqS7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2c2qx7fu4p92j62ksx9.png" alt="MicroK8s cluster is shown in Portainer management page" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[Optional] See the provisioning from the distro&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From a WSL distro point of view, you list before and after the list of &lt;code&gt;snaps&lt;/code&gt; to see the difference once MicroK8s has been deployed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N9kAlKm2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/diaesroiy3jprcno8teo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N9kAlKm2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/diaesroiy3jprcno8teo.png" alt="List the snaps installed before and after the provisioning" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations, you have now deployed a new MicroK8s cluster on a WSL distro while running Portainer as a Windows container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As I stated in the introduction, I was already fan of Portainer before and I can tell the software has grown a lot and the Enterprise features are also well thought.&lt;/p&gt;

&lt;p&gt;I would like to give again a shoutout to the Portainer team for their support and overall kindness during the writing of this blog. You're an amazing team and I wish you to be very successful.&lt;/p&gt;

&lt;p&gt;Lastly, I hope you had fun reading this blog and learnt something out of it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Corsair 🏴‍☠️&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>microk8s</category>
      <category>ubuntu</category>
      <category>kubernetes</category>
      <category>portainer</category>
    </item>
    <item>
      <title>Rancher &amp; MicroK8s</title>
      <dc:creator>Nuno do Carmo</dc:creator>
      <pubDate>Fri, 02 Jun 2023 12:10:33 +0000</pubDate>
      <link>https://forem.com/nunix/rancher-microk8s-5h4e</link>
      <guid>https://forem.com/nunix/rancher-microk8s-5h4e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This blog is an "answer" to the &lt;a href="https://thenewstack.io/can-rancher-deliver-on-making-kubernetes-easy/" rel="noopener noreferrer"&gt;The New Stack article&lt;/a&gt; and the goal is to see how few changes, based on the &lt;a href="https://ranchermanager.docs.rancher.com/" rel="noopener noreferrer"&gt;Rancher official documentation&lt;/a&gt;, could help run the example in the article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;I'm working on Windows and to have a comparable environment, I created an Hyper-V virtual machine (VM) instead of using WSL2.&lt;/p&gt;

&lt;p&gt;Here's the configuration details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VM: 2 cores / 4Go Ram / 60Go disk&lt;/li&gt;
&lt;li&gt;OS: Ubuntu server 22.04&lt;/li&gt;
&lt;li&gt;Option: OpenSSH server installed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I decided to not install MicroK8s from the installer and will instead make it part of the environment configuration steps (see below).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory consumption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the points pointed out by the author, is that "Rancher" requires at least 4Go RAM as mentioned in the &lt;a href="https://ranchermanager.docs.rancher.com/pages-for-subheaders/installation-requirements#docker" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So while there's some sort of misunderstanding in the requirements, I've taken up to the challenge and created the VM with only 4Go.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; the misunderstanding is that the requirements are only for Rancher on Docker, &lt;strong&gt;in a standalone&lt;/strong&gt; server. The author tried to put everything in the same server. This means that only the Rancher requirements were "looked into", and discarded the MicroK8s' own requirements.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For the time being, let's see what a fresh install of Ubuntu server uses:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmsaivjmdt704l3s19df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmsaivjmdt704l3s19df.png" alt="RAM usage after a fresh install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As displayed, the OS footprint is about 200 Mo, which represents only 5% of the RAM available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;Once the OS is installed, we can SSH with the user and password created during the installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  MicroK8s
&lt;/h3&gt;

&lt;p&gt;The first part will be to update the system and install MicroK8s:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Update the repositories&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update

&lt;span class="c"&gt;# Update the packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Install MicroK8s&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;snap &lt;span class="nb"&gt;install &lt;/span&gt;microk8s &lt;span class="nt"&gt;--classic&lt;/span&gt;

&lt;span class="c"&gt;# [Optional] Install Kubectl&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;snap &lt;span class="nb"&gt;install &lt;/span&gt;kubectl &lt;span class="nt"&gt;--classic&lt;/span&gt;
&lt;span class="c"&gt;## [Option 2] Create an alias to `microk8s kubectl`&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;snap &lt;span class="nb"&gt;alias &lt;/span&gt;microk8s.kubectl mk

&lt;span class="c"&gt;# Add the user to the microk8s group&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-G&lt;/span&gt; microk8s &lt;span class="nv"&gt;$USER&lt;/span&gt;
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt; ~/.kube

&lt;span class="c"&gt;# Apply the group change by starting a new session&lt;/span&gt;

&lt;span class="c"&gt;# [Optional] Create the .kube directory&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; ~/.kube

&lt;span class="c"&gt;# Get the Kubeconfig&lt;/span&gt;
microk8s config &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.kube/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Attention:&lt;/strong&gt; MicroK8s shows different cluster IP depending on which &lt;code&gt;kubectl&lt;/code&gt; is used.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvey8elm4pffqwv0e1rxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvey8elm4pffqwv0e1rxf.png" alt="MicroK8s kubectl vs kubectl cluster IP"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Attention 2:&lt;/strong&gt; As of May 2023, the version installed by default is 1.26.4 from the channel 1.26/stable. However the current version of Rancher Manager, 2.7.3, only supports Kubernetes 1.25+. Source: &lt;a href="https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-v2-7-3/#el-48910" rel="noopener noreferrer"&gt;Support matrix | SUSE&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Memory consumption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As stated in &lt;a href="[MicroK8s%20-%20Get%20started](https://microk8s.io/docs/getting-started)"&gt;MicroK8s official documentation&lt;/a&gt;, the cluster doesn't need much RAM, about 500Mo, which fully correlates with the RAM usage once MicroK8s has been installed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52gnq3remnt6lb66f3up.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52gnq3remnt6lb66f3up.png" alt="RAM usage after MicroK8s install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As displayed, the current RAM used is around 700Mo which represents the 200Mo from the OS and the 500Mo from MicroK8s. So we're about 20% of RAM usage, which seems plenty to continue.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker
&lt;/h3&gt;

&lt;p&gt;The second part and which relates now to the article, is the installation of Docker which will be used to run the Rancher container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install the dependencies&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;apt-transport-https ca-certificates curl gnupg lsb-release &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Install the Docker repository GPG key&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://download.docker.com/linux/ubuntu/gpg | &lt;span class="nb"&gt;sudo &lt;/span&gt;gpg &lt;span class="nt"&gt;--dearmor&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; /usr/share/keyrings/docker-archive-keyring.gpg

&lt;span class="c"&gt;# Add the Docker repository&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"deb [arch="&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;dpkg &lt;span class="nt"&gt;--print-architecture&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;" signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu "&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; /etc/os-release &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$VERSION_CODENAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;" stable"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/docker.list &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null

&lt;span class="c"&gt;# Update the repositories&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update

&lt;span class="c"&gt;# Install docker&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;docker-ce docker-ce-cli containerd.io &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Add the user to the docker group&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; docker &lt;span class="nv"&gt;$USER&lt;/span&gt;

&lt;span class="c"&gt;# Apply the group change by starting a new session&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Memory consumption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker install doesn't consume much, around 20Mo only. This is normal as the daemon is idle with no containers running:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8li1lgfjebb1ys0tfrk1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8li1lgfjebb1ys0tfrk1.png" alt="RAM usage after Docker install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's try to run a "minimal" Nginx container from the &lt;a href="https://github.com/chainguard-images/images/tree/main/images/nginx#usage" rel="noopener noreferrer"&gt;Chainguard image&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj416x5b39aeuc219osz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj416x5b39aeuc219osz.png" alt="RAM usage with a Nginx container running"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even with such minimal container running, the RAM usage is about 90Mo.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; before continuing, I stopped all the containers running and rebooted the server. This brought bach the RAM usage to 790+Mo&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Rancher Manager
&lt;/h3&gt;

&lt;p&gt;Here's the final component, and so far the RAM usage seems to handle pretty well the workloads.&lt;/p&gt;

&lt;p&gt;I'll start a new container based on the latest Rancher version, instead of 2.4 as described in the article. The reason why the author faced issues between Rancher and MicroK8s is due to the version mismatch.&lt;/p&gt;

&lt;p&gt;The current version of Rancher, 2.7.3, only supports Kubernetes versions up to 1.25 (as described in the official &lt;a href="https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-v2-7-3/#el-48910" rel="noopener noreferrer"&gt;Rancher Support Matrix&lt;/a&gt;. However, the default MicroK8s version is 1.26.&lt;/p&gt;

&lt;p&gt;I'll explain later how we can easily change the MicroK8s version, but let's go back to the Rancher container.&lt;/p&gt;

&lt;p&gt;The command to start the container is the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start a new Rancher container&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rancher-server &lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;unless-stopped &lt;span class="nt"&gt;-p&lt;/span&gt; 80:80 &lt;span class="nt"&gt;-p&lt;/span&gt; 443:443 &lt;span class="nt"&gt;--privileged&lt;/span&gt; rancher/rancher:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the container started, Rancher is available via the web on the address of the server. Example: &lt;a href="https://192.168.0.31" rel="noopener noreferrer"&gt;https://192.168.0.31&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory consumption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Rancher container contains a K3s single node cluster, the containerD runtime and Rancher Manager installed. This is reflected in the memory usage:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwgah458zvdnewr29m4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwgah458zvdnewr29m4h.png" alt="RAM usage with Rancher container running"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As displayed, this is a clear jump in RAM usage as it went from almost 800Mo to 2Go+, which represents 50% of the total RAM.&lt;/p&gt;

&lt;p&gt;Still, there's plenty of RAM to continue and perform the last task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add MicroK8s to Rancher
&lt;/h2&gt;

&lt;p&gt;As stated above, one of the issue the author ran into was due to a version mismatch. &lt;/p&gt;

&lt;p&gt;The current default version installed by MicroK8s is 1.26. So to ensure the compatibility between Rancher and MicroK8s, the version needs to be downgraded to 1.25.&lt;/p&gt;

&lt;p&gt;Thanks to the concept of &lt;code&gt;snap channels&lt;/code&gt;, this can be achieved in one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# [Optional] Check the current MicroK8s version&lt;/span&gt;
microk8s version

&lt;span class="c"&gt;# Change the channel to the 1.25 stable&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;snap refresh microk8s &lt;span class="nt"&gt;--channel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1.25/stable

&lt;span class="c"&gt;# [Optional] Check the current MicroK8s version&lt;/span&gt;
microk8s version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F835jy5unsbfz0ytqj0ib.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F835jy5unsbfz0ytqj0ib.png" alt="Change the MicroK8s channel to 1.25"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that all the components have compatible versions, MicroK8s can be imported into Rancher in the web interface as follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the welcome page, once logged in, click on &lt;code&gt;Import Existing&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6178aii8vuweys6went1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6178aii8vuweys6went1.png" alt="Import Existing cluster in Rancher"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose &lt;code&gt;Generic&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntfmrmos45nlrcwpog58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntfmrmos45nlrcwpog58.png" alt="Import a Generic cluster"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write a name, all lowercase, and click &lt;code&gt;Create&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83lnfd1hqjfv371dbg6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83lnfd1hqjfv371dbg6b.png" alt="Provide a name and click create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the registration page, click on the second option &lt;code&gt;curl --insecure ...&lt;/code&gt; to copy the text&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu0aqdsezkosox4d32q3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu0aqdsezkosox4d32q3.png" alt="Run the registration command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; Based on how Rancher was installed with the Docker command, it created a self-signed certificate. This means that MicroK8s will not have the corresponding certificate and would generate an error if the first option was used&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Once the registration completes, the node will appear as active&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0al09jb0s39u3bsnw24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0al09jb0s39u3bsnw24.png" alt="Details of the imported cluster node"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory consumption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After all the tasks were done, and which were successful, the final RAM usage is around 2.5Go, which represents 60%+:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6enzsz95lybvzpnjhsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6enzsz95lybvzpnjhsh.png" alt="RAM usage after MicroK8s cluster was imported in Rancher"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As stated in a tweet, this article comes with a bitter-sweet taste for me.&lt;/p&gt;

&lt;p&gt;In one end, I can totally relate to the "learning in public" by writing blog posts, trying new technology and making (many) mistakes while doing so.&lt;/p&gt;

&lt;p&gt;However when I face specific issues that others don't seem to have, then I tend to ask for help on different community channels, and of course I go back to the products/projects official documentation.&lt;/p&gt;

&lt;p&gt;This is also where I don't relate &lt;strong&gt;at all&lt;/strong&gt;, with the article as a whole and have some questions about the publishing process of The New Stack. The article ends abruptly by stating: Portainer is better, use it!&lt;/p&gt;

&lt;p&gt;Well, because the article is somewhat incorrect in certain points, again due to the lack of documentation checking, the article actually brought a shade on both Portainer and MicroK8s which never asked for it (I got DMs from both companies).&lt;/p&gt;

&lt;p&gt;So here's my advice to anyone reading this blog post: please continue learning in public, ask questions and if you face issues ask for help. But sincerely, avoid doing unwanted comparisons and READ THE DOCS! I'm a Tech Writer, if my docs are not good/complete, open an issue, they're ALL open sourced.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Corsair 🏴‍☠️&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>microk8s</category>
      <category>rancher</category>
      <category>docker</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
