Install MicroK8s On Linux
```shell sudo snap install microk8s --classic ```
To install MicroK8s on Linux, follow these steps:
-
Install MicroK8s using Snap:
```shell sudo snap install microk8s --classic ```
-
If you don't have the
snap
command, you need to set up Snapd. Refer to Snapcraft Installation Guide for instructions. -
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
-
Check the status while Kubernetes starts:
```shell microk8s status --wait-ready ```
-
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, usemicrok8s disable <name>
. -
Start using Kubernetes and view resources in all namespaces:
```shell microk8s kubectl get all --all-namespaces ```
-
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 ofmicrok8s kubectl
. Since it's a standard upstreamkubectl
, you can also use it with other Kubernetes clusters by specifying a kubeconfig file using the--kubeconfig
argument. -
Access the Kubernetes dashboard:
```shell microk8s dashboard-proxy ```
Managing Resources
-
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.