How to list all namespaces in microk8s?

The command to get all namespaces in is:

microk8s kubectl get namespaces


dev@codetryout:~$ sudo microk8s kubectl get namespaces
NAME              STATUS   AGE
kube-system       Active   4m45s
kube-public       Active   4m45s
kube-node-lease   Active   4m45s
default           Active   4m44s
ingress           Active   2m20s

Alternatively, you may use the -A parameter,

 microk8s kubectl get namespaces -A

To obtain more options or help, use the below command

microk8s kubectl get namespaces --help

What is MicroK8s?

MicroK8s is a lightweight and easy-to-install Kubernetes distribution developed by Canonical for simplified local development and testing. It enables users to quickly set up a single-node Kubernetes cluster on their machines, making it accessible to developers and administrators. With features like easy installation, single-node deployment, and optional add-ons, MicroK8s provides a convenient way to experiment with Kubernetes in resource-constrained environments. It is distributed as a snap package, allowing for simple installation and updates, and is suitable for scenarios where a full-scale production Kubernetes cluster is not required.