canonical / microk8s.io

Code for the microk8s.io website by Canonical
https://microk8s.io
18 stars 63 forks source link

Update command examples from "Install MicroK8s" section #646

Open neitsab opened 6 months ago

neitsab commented 6 months ago

Summary

The command examples provided at https://microk8s.io/#install-microk8s don't match the experience on a fresh Ubuntu Server 22.04.4 install:

Process

Current and expected result

First we observe that sudo is required for microk8s invocation:

$ microk8s status --wait-ready
Insufficient permissions to access MicroK8s.
You can either try again with sudo or add the user neitsab to the 'microk8s' group:

    sudo usermod -a -G microk8s neitsab
    sudo chown -R neitsab ~/.kube

After this, reload the user groups either via a reboot or by running 'newgrp microk8s'.

Secondly, that the dns addon is already enabled by default so trying to enable it manually proves redundant:

$ sudo microk8s status --wait-ready
microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes

$ sudo microk8s enable dns
Infer repository core for addon dns
Addon core/dns is already enabled

Finally, that the istio addon isn't in the core repository anymore, leading to two different outcomes depending on the architecture:

$ sudo microk8s enable istio
Addon istio was not found in any repository
$ sudo microk8s enable istio
Addon istio was not found in any repository
To use the community maintained flavor enable the respective repository:

    microk8s enable community

Versions

neitsab commented 6 months ago

Regarding the requirement for elevated permissions to use microk8s, as an alternative to using sudo, instructions could be copied from https://ubuntu.com/kubernetes/install#tab-linux__content to "add your user to the microk8s admin group":

MicroK8s creates a group to enable seamless usage of commands which require admin privilege. Use the following commands to join the group:

sudo usermod -a -G microk8s $USER

sudo chown -f -R $USER ~/.kube

You will also need to re-enter the session for the group update to take place:

su - $USER