Skip to main content

Install MicroK8s On Linux

```shell sudo snap install microk8s --classic ```

To install MicroK8s on Linux, follow these steps:

  1. Install MicroK8s using Snap:

    ```shell sudo snap install microk8s --classic ```

  2. If you don't have the snap command, you need to set up Snapd. Refer to Snapcraft Installation Guide for instructions.

  3. Add your user to the MicroK8s admin group and adjust permissions:

    ```shell sudo usermod -a -G microk8s $USER sudo chown -f -R $USER ~/.kube ```

    For the group changes to take effect, you'll need to re-enter the session:

    ```shell su - $USER ```

Getting Started

  1. Check the status while Kubernetes starts:

    ```shell microk8s status --wait-ready ```

  2. Turn on the services you want, such as the dashboard, DNS, and Ingress:

    ```shell microk8s enable dashboard dns ingress ```

    You can see a list of available services and optional features using microk8s enable --help. To disable a service, use microk8s disable <name>.

  3. Start using Kubernetes and view resources in all namespaces:

    ```shell microk8s kubectl get all --all-namespaces ```

  4. Optionally, you can make microk8s kubectl the default Kubernetes command-line tool by creating an alias:

    ```shell alias mkctl="microk8s kubectl" ```

    This allows you to use mkctl instead of microk8s kubectl. Since it's a standard upstream kubectl, you can also use it with other Kubernetes clusters by specifying a kubeconfig file using the --kubeconfig argument.

  5. Access the Kubernetes dashboard:

    ```shell microk8s dashboard-proxy ```

Managing Resources

  1. Start and stop Kubernetes to save battery when you don't need it running in the background:

    • Start Kubernetes:

      ```shell microk8s start ```

    • Stop Kubernetes:

      ```shell microk8s stop ```

    Managing these services can help conserve system resources.

These steps will help you install MicroK8s on Linux and get started with Kubernetes. Adjust the services according to your needs and manage Kubernetes resources efficiently.