Ubuntu 22.04
Sponsored Link

MicroK8s : Install
2022/09/02
 
Install [MicroK8s] that is the Lightweight Kubernetes provided by Canonical.
[1] Install MicroK8s from Snappy.
Snappy is installed and running by default on Ubuntu Server but if it's not running, Start it first by [systemctl start snapd.socket].
root@dlp:~#
snap install microk8s --classic

microk8s (1.24/stable) v1.24.3 from Canonical✓ installed
[2] After installing MicroK8s, it is running automatically. To stop or start it, set like follows.
# show status

root@dlp:~#
microk8s status

microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    ha-cluster           # (core) Configure high availability on the current node
  disabled:
    community            # (core) The community addons repository
    dashboard            # (core) The Kubernetes dashboard
    dns                  # (core) CoreDNS
    gpu                  # (core) Automatic enablement of Nvidia CUDA
    helm                 # (core) Helm 2 - the package manager for Kubernetes
    helm3                # (core) Helm 3 - Kubernetes package manager
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    prometheus           # (core) Prometheus operator for monitoring and logging
    rbac                 # (core) Role-Based Access Control for authorisation
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated

# show config

root@dlp:~#
microk8s config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSU.....
    server: https://10.0.0.30:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: MUV6TU54VXlQR2JJRDFadU9lNXlQbHlpaVhEQ1o4MXNhRjQreVEvakNRRT0K

root@dlp:~#
microk8s kubectl get all

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.152.183.1   <none>        443/TCP   6m11s

root@dlp:~#
microk8s kubectl get nodes

NAME            STATUS   ROLES    AGE     VERSION
dlp.srv.world   Ready    <none>   6m45s   v1.24.3-2+63243a96d1c393

# stop MicroK8s

root@dlp:~#
microk8s stop

Stopped.
root@dlp:~#
microk8s status

microk8s is not running, try microk8s start
# start MicroK8s

root@dlp:~#
microk8s start

Started.
# disable MicroK8s

root@dlp:~#
snap disable microk8s

microk8s disabled
# enable MicroK8s

root@dlp:~#
snap enable microk8s

microk8s enabled
Matched Content