Install MicroK8s.
Instalation
Search for microk8s
snap.
$ snap search microk8s
Name Version Publisher Notes Summary microk8s v1.27.2 canonical✓ classic Kubernetes for workstations and appliances microk8s-integrator-windows 0.1 canonical✓ - MicroK8s Windows integrator microk8s-integrator-macos 0.1 canonical✓ - MicroK8s MacOS integrator eks v1.18.9 canonical✓ classic Amazon EKS Distro (EKS-D) snap pluto 0.1.0 nuccitheboss - A swiss-army knife for managing HPC clusters built with Ubuntu content-microk8s-core-addons-offline latest aggkolaitis - MicroK8s Core addons offline fortd v0.9.10-mk8s-ad50fb2 ffoysal - A snap to keep your data at your own data center content-demo-microk8s latest kjackal -
Display snap details.
$ snap info microk8s
name: microk8s summary: Kubernetes for workstations and appliances publisher: Canonical✓ store-url: https://snapcraft.io/microk8s contact: https://github.com/canonical/microk8s license: Apache-2.0 description: | MicroK8s is a small, fast, secure, certified Kubernetes distribution that installs on just about any Linux box. It provides the functionality of core Kubernetes components, in a small footprint, scalable from a single node to a high-availability production multi-node cluster. Use it for offline developments, prototyping, testing, CI/CD. It's also great for appliances - develop your IoT apps for K8s and deploy them to MicroK8s on your boxes. snap-id: EaXqgt1lyCaxKaQCU349mlodBkDCXRcg channels: 1.27/stable: v1.27.2 2023-05-29 (5372) 177MB classic 1.27/candidate: v1.27.4 2023-07-22 (5643) 177MB classic 1.27/beta: v1.27.4 2023-07-22 (5643) 177MB classic 1.27/edge: v1.27.4 2023-07-21 (5643) 177MB classic latest/stable: v1.27.2 2023-06-05 (5372) 177MB classic latest/candidate: v1.27.3 2023-07-10 (5577) 177MB classic latest/beta: v1.27.4 2023-07-21 (5635) 184MB classic latest/edge: v1.27.4 2023-07-28 (5677) 184MB classic dqlite/stable: – dqlite/candidate: – dqlite/beta: – dqlite/edge: v1.16.2 2019-11-07 (1038) 189MB classic 1.28/stable: – 1.28/candidate: v1.28.0-rc.0 2023-07-27 (5676) 183MB classic 1.28/beta: v1.28.0-beta.0 2023-07-21 (5654) 185MB classic 1.28/edge: v1.28.0-alpha.4 2023-07-07 (5560) 178MB classic 1.27-strict/stable: v1.27.2 2023-06-07 (5371) 177MB - 1.27-strict/candidate: v1.27.4 2023-07-23 (5657) 177MB - 1.27-strict/beta: v1.27.4 2023-07-23 (5657) 177MB - 1.27-strict/edge: v1.27.4 2023-07-22 (5657) 177MB - 1.26-strict/stable: v1.26.6 2023-07-13 (5480) 171MB - 1.26-strict/candidate: v1.26.6 2023-07-13 (5480) 171MB - 1.26-strict/beta: v1.26.6 2023-07-13 (5480) 171MB - 1.26-strict/edge: v1.26.6 2023-06-14 (5480) 171MB - 1.26/stable: v1.26.6 2023-07-13 (5479) 171MB classic 1.26/candidate: v1.26.6 2023-07-13 (5479) 171MB classic 1.26/beta: v1.26.6 2023-07-13 (5479) 171MB classic 1.26/edge: v1.26.6 2023-06-14 (5479) 171MB classic 1.25-strict/stable: v1.25.11 2023-07-13 (5471) 169MB - 1.25-strict/candidate: v1.25.11 2023-07-12 (5471) 169MB - 1.25-strict/beta: v1.25.11 2023-07-12 (5471) 169MB - 1.25-strict/edge: v1.25.11 2023-06-14 (5471) 169MB - 1.25-eksd/stable: v1.25-17 2023-07-17 (5552) 175MB classic 1.25-eksd/candidate: v1.25-18 2023-07-21 (5630) 176MB classic 1.25-eksd/beta: v1.25-18 2023-07-21 (5630) 176MB classic 1.25-eksd/edge: v1.25-18 2023-07-20 (5630) 176MB classic 1.25/stable: v1.25.11 2023-07-11 (5472) 169MB classic 1.25/candidate: v1.25.11 2023-07-11 (5472) 169MB classic 1.25/beta: v1.25.11 2023-07-11 (5472) 169MB classic 1.25/edge: v1.25.11 2023-06-14 (5472) 169MB classic 1.24-eksd/stable: v1.24-21 2023-07-15 (5547) 172MB classic 1.24-eksd/candidate: v1.24-22 2023-07-21 (5629) 172MB classic 1.24-eksd/beta: v1.24-22 2023-07-21 (5629) 172MB classic 1.24-eksd/edge: v1.24-22 2023-07-20 (5629) 172MB classic 1.24/stable: v1.24.15 2023-07-10 (5469) 225MB classic 1.24/candidate: v1.24.16 2023-07-20 (5625) 225MB classic 1.24/beta: v1.24.16 2023-07-20 (5625) 225MB classic 1.24/edge: v1.24.16 2023-07-19 (5625) 225MB classic 1.23-eksd/stable: v1.23-27 2023-07-28 (5628) 168MB classic 1.23-eksd/candidate: v1.23-27 2023-07-20 (5628) 168MB classic 1.23-eksd/beta: v1.23-27 2023-07-20 (5628) 168MB classic 1.23-eksd/edge: v1.23-27 2023-07-20 (5628) 168MB classic 1.23/stable: v1.23.17 2023-03-30 (4916) 213MB classic 1.23/candidate: v1.23.17 2023-03-29 (4916) 213MB classic 1.23/beta: v1.23.17 2023-03-29 (4916) 213MB classic 1.23/edge: v1.23.17 2023-05-30 (5391) 213MB classic 1.22-eksd/stable: v1.22-26 2023-05-18 (5261) 164MB classic 1.22-eksd/candidate: v1.22-26 2023-04-27 (5261) 164MB classic 1.22-eksd/beta: v1.22-26 2023-04-27 (5261) 164MB classic 1.22-eksd/edge: v1.22-26 2023-04-26 (5261) 164MB classic 1.22/stable: v1.22.17 2023-04-29 (4915) 187MB classic 1.22/candidate: v1.22.17 2023-04-27 (4915) 187MB classic 1.22/beta: v1.22.17 2023-04-27 (4915) 187MB classic 1.22/edge: v1.22.17 2023-03-16 (4915) 187MB classic 1.21/stable: v1.21.13 2022-07-20 (3410) 191MB classic 1.21/candidate: v1.21.13 2022-07-09 (3410) 191MB classic 1.21/beta: v1.21.13 2022-07-09 (3410) 191MB classic 1.21/edge: v1.21.13 2022-06-08 (3410) 191MB classic 1.20/stable: v1.20.13 2021-12-08 (2760) 221MB classic 1.20/candidate: v1.20.13 2021-12-07 (2760) 221MB classic 1.20/beta: v1.20.13 2021-12-07 (2760) 221MB classic 1.20/edge: v1.20.14 2022-01-11 (2843) 217MB classic 1.19/stable: v1.19.15 2021-09-30 (2530) 216MB classic 1.19/candidate: v1.19.15 2021-09-29 (2530) 216MB classic 1.19/beta: v1.19.15 2021-09-29 (2530) 216MB classic 1.19/edge: v1.19.16 2022-01-07 (2820) 212MB classic 1.18/stable: v1.18.20 2021-07-12 (2271) 198MB classic 1.18/candidate: v1.18.20 2021-07-12 (2271) 198MB classic 1.18/beta: v1.18.20 2021-07-12 (2271) 198MB classic 1.18/edge: v1.18.20 2021-11-03 (2647) 198MB classic 1.17/stable: v1.17.17 2021-01-15 (1916) 177MB classic 1.17/candidate: v1.17.17 2021-01-14 (1916) 177MB classic 1.17/beta: v1.17.17 2021-01-14 (1916) 177MB classic 1.17/edge: v1.17.17 2021-01-13 (1916) 177MB classic 1.16/stable: v1.16.15 2020-09-12 (1671) 179MB classic 1.16/candidate: v1.16.15 2020-09-04 (1671) 179MB classic 1.16/beta: v1.16.15 2020-09-04 (1671) 179MB classic 1.16/edge: v1.16.15 2020-09-02 (1671) 179MB classic 1.15/stable: v1.15.11 2020-03-27 (1301) 171MB classic 1.15/candidate: v1.15.11 2020-03-27 (1301) 171MB classic 1.15/beta: v1.15.11 2020-03-27 (1301) 171MB classic 1.15/edge: v1.15.11 2020-03-26 (1301) 171MB classic 1.14/stable: v1.14.10 2020-01-06 (1120) 217MB classic 1.14/candidate: ↑ 1.14/beta: ↑ 1.14/edge: v1.14.10 2020-03-26 (1303) 217MB classic 1.13/stable: v1.13.6 2019-06-06 (581) 237MB classic 1.13/candidate: ↑ 1.13/beta: ↑ 1.13/edge: ↑ 1.12/stable: v1.12.9 2019-06-06 (612) 259MB classic 1.12/candidate: ↑ 1.12/beta: ↑ 1.12/edge: ↑ 1.11/stable: v1.11.10 2019-05-10 (557) 258MB classic 1.11/candidate: ↑ 1.11/beta: ↑ 1.11/edge: ↑ 1.10/stable: v1.10.13 2019-04-22 (546) 222MB classic 1.10/candidate: ↑ 1.10/beta: ↑ 1.10/edge: ↑
Install MicroK8s snap.
$ sudo snap install microk8s --classic --channel=1.27/stable
microk8s (1.27/stable) v1.27.2 from Canonical✓ installed
Ensure that you are inside microk8s
group.
$ sudo usermod -a -G microk8s $USER
Log in to a new group.
$ newgrp microk8s
Display MicroK8s version.
$ microk8s version
MicroK8s v1.27.2 revision 5372
Display service status and plugins.
$ microk8s status
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 disabled: cert-manager # (core) Cloud native certificate management community # (core) The community addons repository dashboard # (core) The Kubernetes dashboard gpu # (core) Automatic enablement of Nvidia CUDA 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 kube-ovn # (core) An advanced network fabric for Kubernetes mayastor # (core) OpenEBS MayaStor metallb # (core) Loadbalancer for your Kubernetes cluster metrics-server # (core) K8s Metrics Server for API access to service metrics minio # (core) MinIO object storage observability # (core) A lightweight observability stack for logs, traces and 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
Enable additional plugin.
$ microk8s enable metrics-server
Infer repository core for addon metrics-server Enabling Metrics-Server serviceaccount/metrics-server created clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created clusterrole.rbac.authorization.k8s.io/system:metrics-server created rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created service/metrics-server created deployment.apps/metrics-server created apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created clusterrolebinding.rbac.authorization.k8s.io/microk8s-admin created Metrics-Server is enabled
Use kubectl
utility.
$ microk8s kubectl get namespaces
NAME STATUS AGE kube-system Active 2m33s kube-public Active 2m33s kube-node-lease Active 2m33s default Active 2m33s
$ microk8s kubectl --namespace kube-system get pods
NAME READY STATUS RESTARTS AGE calico-node-nf4mh 1/1 Running 0 3m6s coredns-7745f9f87f-nldb2 1/1 Running 0 3m6s calico-kube-controllers-6c99c8747f-vktrf 1/1 Running 0 3m6s metrics-server-7747f8d66b-mmqdn 1/1 Running 0 71s
$ microk8s kubectl --namespace kube-system get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns ClusterIP 10.152.183.1053/UDP,53/TCP,9153/TCP 3m28s metrics-server ClusterIP 10.152.183.231 443/TCP 90s
Reset MicroK8s node to its initial state.
$ sudo microk8s reset
Disabling all addons Disabling addon : core/cert-manager Disabling addon : core/dashboard Disabling addon : core/dns Disabling addon : core/gpu Disabling addon : core/helm Disabling addon : core/helm3 Disabling addon : core/host-access Disabling addon : core/hostpath-storage Disabling addon : core/ingress Disabling addon : core/kube-ovn Disabling addon : core/mayastor Disabling addon : core/metallb Disabling addon : core/metrics-server Disabling addon : core/minio Disabling addon : core/observability Disabling addon : core/prometheus Disabling addon : core/rbac Disabling addon : core/registry Disabling addon : core/storage All addons are disabled. Deleting the CNI Cleaning resources in namespace kube-system Cleaning resources in namespace kube-public Cleaning resources in namespace kube-node-lease Cleaning resources in namespace default Removing CRDs Removing PriorityClasses Removing StorageClasses Restarting cluster Stopped. Setting up the CNI
Stop or start service.
$ microk8s stop
Stopped.
$ microk8s start
Remove MicroK8s snap.
$ sudo snap remove microk8s
microk8s removed
Use initial configuration
Inspect configuration schema.
--- version: 0.1.0 persistentClusterToken: my-token extraSANs: - 10.10.10.10 - microk8s.example.com extraKubeAPIServerArgs: --authorization-mode: RBAC,Node --event-ttl: null extraKubeletArgs: --cluster-dns: 10.152.183.10 extraKubeProxyArgs: --cluster-cidr: 10.1.0.0/16 extraKubeControllerManagerArgs: --leader-elect-lease-duration: 30s --leader-elect-renew-deadline: 15s extraKubeSchedulerArgs: --leader-elect-lease-duration: 30s --leader-elect-renew-deadline: 15s extraContainerdArgs: -l: debug extraContainerdEnv: http_proxy: http://squid.internal:3128 https_proxy: http://squid.internal:3128 extraDqliteArgs: --disk-mode: "true" extraDqliteEnv: LIBRAFT_TRACE: "1" LIBDQLITE_TRACE: "1" extraConfigFiles: flannel-network-mgr-config: | {"Network": "10.1.0.0/16", "Backend": {"Type": "vxlan"}} addons: - name: dns - name: mayastor args: [--default-pool-size, 20GB] - name: registry disable: true addonRepositories: - name: core url: https://github.com/canonical/microk8s-core-addons - name: community url: /snap/microk8s/current/addons/community reference: 1.26 containerdRegistryConfigs: docker.io: server = "http://my.proxy:5000" join: url: 10.0.0.10:25000/my-token/hash worker: true extraCNIEnv: IPv4_SUPPORT: true IPv4_CLUSTER_CIDR: 10.2.0.0/16 IPv4_SERVICE_CIDR: 10.153.183.0/24
Inspect default launch configuration.
# Default launch configuration for MicroK8s. --- version: 0.1.0 extraKubeletArgs: --cluster-domain: cluster.local --cluster-dns: 10.152.183.10 addons: - name: dns
Create your own configuration.
$ tee microk8s-config.yaml <<EOF --- version: 0.1.0 extraKubeletArgs: --cluster-domain: cluster.local --cluster-dns: 10.152.183.10 addons: - name: dns - name: metrics-server - name: hostpath-storage EOF
Install MicroK8s.
$ sudo snap install microk8s --classic --channel=1.27/stable
microk8s (1.27/stable) v1.27.2 from Canonical✓ installed
Inspect initial state.
$ microk8s status
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 disabled: cert-manager # (core) Cloud native certificate management community # (core) The community addons repository dashboard # (core) The Kubernetes dashboard gpu # (core) Automatic enablement of Nvidia CUDA 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 kube-ovn # (core) An advanced network fabric for Kubernetes mayastor # (core) OpenEBS MayaStor metallb # (core) Loadbalancer for your Kubernetes cluster metrics-server # (core) K8s Metrics Server for API access to service metrics minio # (core) MinIO object storage observability # (core) A lightweight observability stack for logs, traces and 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
Load custom configuration.
$ sudo snap set microk8s config="$(cat microk8s-config.yaml)"
Inspect enabled addons.
$ microk8s status
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 hostpath-storage # (core) Storage class; allocates storage from host directory metrics-server # (core) K8s Metrics Server for API access to service metrics storage # (core) Alias to hostpath-storage add-on, deprecated disabled: cert-manager # (core) Cloud native certificate management community # (core) The community addons repository dashboard # (core) The Kubernetes dashboard gpu # (core) Automatic enablement of Nvidia CUDA host-access # (core) Allow Pods connecting to Host services smoothly ingress # (core) Ingress controller for external access kube-ovn # (core) An advanced network fabric for Kubernetes mayastor # (core) OpenEBS MayaStor metallb # (core) Loadbalancer for your Kubernetes cluster minio # (core) MinIO object storage observability # (core) A lightweight observability stack for logs, traces and 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
Enable dashboard
Enable ingress addon.
$ microk8s enable ingress
Infer repository core for addon ingress Enabling Ingress ingressclass.networking.k8s.io/public created ingressclass.networking.k8s.io/nginx created namespace/ingress created serviceaccount/nginx-ingress-microk8s-serviceaccount created clusterrole.rbac.authorization.k8s.io/nginx-ingress-microk8s-clusterrole created role.rbac.authorization.k8s.io/nginx-ingress-microk8s-role created clusterrolebinding.rbac.authorization.k8s.io/nginx-ingress-microk8s created rolebinding.rbac.authorization.k8s.io/nginx-ingress-microk8s created configmap/nginx-load-balancer-microk8s-conf created configmap/nginx-ingress-tcp-microk8s-conf created configmap/nginx-ingress-udp-microk8s-conf created daemonset.apps/nginx-ingress-microk8s-controller created Ingress is enabled
Enable dashboard addon.
$ microk8s enable dashboard
Infer repository core for addon dashboard Enabling Kubernetes Dashboard Infer repository core for addon metrics-server Addon core/metrics-server is already enabled Applying manifest serviceaccount/kubernetes-dashboard created service/kubernetes-dashboard created secret/kubernetes-dashboard-certs created secret/kubernetes-dashboard-csrf created secret/kubernetes-dashboard-key-holder created configmap/kubernetes-dashboard-settings created role.rbac.authorization.k8s.io/kubernetes-dashboard created clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created deployment.apps/kubernetes-dashboard created service/dashboard-metrics-scraper created deployment.apps/dashboard-metrics-scraper created secret/microk8s-dashboard-token created If RBAC is not enabled access the dashboard using the token retrieved with: microk8s kubectl describe secret -n kube-system microk8s-dashboard-token Use this token in the https login UI of the kubernetes-dashboard service. In an RBAC enabled setup (microk8s enable RBAC) you need to create a user with restricted permissions as shown in: https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
Get dashboard token.
$ microk8s kubectl describe secret -n kube-system microk8s-dashboard-token
Name: microk8s-dashboard-token Namespace: kube-system Labels:Annotations: kubernetes.io/service-account.name: default kubernetes.io/service-account.uid: 18240139-cc29-4595-8d68-dccad867a1b1 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1123 bytes namespace: 11 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IjlXbVFWbVUwZEdWdHBEOXdPVlZLZERrYnVkYloxcFZSUEZVcUxhRTV6Z1EifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJtaWNyb2s4cy1kYXNoYm9hcmQtdG9rZW4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjE4MjQwMTM5LWNjMjktNDU5NS04ZDY4LWRjY2FkODY3YTFiMSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTpkZWZhdWx0In0.QbMXdh3WO0qUl0bO_M_H4NYNkgHd2pYxkmLxfuNwKcM5QaPxs8Kn_pbi2niOL8IMqPfG1IQEESim6zseeKc1pjQcd9_EWU8ZsyfuxFPzruczGVmGMcp60Z9z2szh79XpWhnVIDlLztc0OvJdawo8gJSjNqa5qcSid1ULpIEPbg_eZ1d7mpt_TVDQVVyTUxJtKftRVShfDJ9aOQURgA3vW-oa_3CGmY5IxWonobwBNmxFAX_m1RaFq1skdm1almKyBpN5-mJHAyaryK6WB3tZ2kcazi8lBSKDzQSgX4RwrrWzwVJaPhbty72JaUdWUjPuPDp0G1rxccKy6r-v1pVEtA
Update domain entry for kubernetes-dashboard.microk8s
using DNS or host file database as it should point to the microk8s server.
Create ingress for dashboard using kubernetes-dashboard.microk8s
domain name.
$ tee kubernetes-dashboard-ingress.yaml <<EOF --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" name: kubernetes-dashboard-ingress namespace: kube-system spec: rules: - host: kubernetes-dashboard.microk8s http: paths: - pathType: Prefix path: / backend: service: name: kubernetes-dashboard port: number: 443 EOF
$ microk8s kubectl create -f kubernetes-dashboard-ingress.yaml
ingress.networking.k8s.io/kubernetes-dashboard-ingress created
Open https://kubernetes-dashboard.microk8s/
address and inspect namespaces and objects.
RBAC is currently disabled, you play with it as you wish.

Create MicroK8s cluster
Inspect service status.
$ microk8s status
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 disabled: cert-manager # (core) Cloud native certificate management community # (core) The community addons repository gpu # (core) Automatic enablement of Nvidia CUDA host-access # (core) Allow Pods connecting to Host services smoothly kube-ovn # (core) An advanced network fabric for Kubernetes mayastor # (core) OpenEBS MayaStor metallb # (core) Loadbalancer for your Kubernetes cluster minio # (core) MinIO object storage observability # (core) A lightweight observability stack for logs, traces and 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
Display cluster nodes.
$ microk8s kubectl get nodes
NAME STATUS ROLES AGE VERSION microk8s-cheetah-1 Ready49m v1.27.2
Ensure that that each node contains an updated hosts file database.
$ sudo tee -a /etc/hosts <<EOF 192.168.8.155 microk8s-cheetah-1 192.168.8.160 microk8s-cheetah-2 192.168.8.161 microk8s-cheetah-3 EOF
Create one-time token to add new node.
$ microk8s add-node
From the node you wish to join to this cluster, run the following: microk8s join 192.168.8.155:25000/fcb361e00e93aa7a5af57ac460cbc088/1ac8f85f31b9 Use the '--worker' flag to join a node as a worker not running the control plane, eg: microk8s join 192.168.8.155:25000/fcb361e00e93aa7a5af57ac460cbc088/1ac8f85f31b9 --worker If the node you are adding is not reachable through the default interface you can use one of the following: microk8s join 192.168.8.155:25000/fcb361e00e93aa7a5af57ac460cbc088/1ac8f85f31b9
Join cluster from different node.
$ microk8s join 192.168.8.155:25000/fcb361e00e93aa7a5af57ac460cbc088/1ac8f85f31b9
Contacting cluster at 192.168.8.155 Waiting for this node to finish joining the cluster. .. .. ..
Inspect service status.
$ microk8s status
microk8s is running high-availability: yes datastore master nodes: 192.168.8.155:19001 192.168.8.161:19001 192.168.8.160: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 disabled: cert-manager # (core) Cloud native certificate management community # (core) The community addons repository dashboard # (core) The Kubernetes dashboard gpu # (core) Automatic enablement of Nvidia CUDA 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 kube-ovn # (core) An advanced network fabric for Kubernetes mayastor # (core) OpenEBS MayaStor metallb # (core) Loadbalancer for your Kubernetes cluster metrics-server # (core) K8s Metrics Server for API access to service metrics minio # (core) MinIO object storage observability # (core) A lightweight observability stack for logs, traces and 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
Display cluster nodes.
$ microk8s kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME microk8s-cheetah-1 Ready26h v1.27.2 192.168.8.155 Ubuntu 22.04.2 LTS 5.15.0-73-generic containerd://1.6.15 microk8s-cheetah-3 Ready 64s v1.27.2 192.168.8.161 Ubuntu 22.04.2 LTS 5.15.0-73-generic containerd://1.6.15 microk8s-cheetah-2 Ready 30s v1.27.2 192.168.8.160 Ubuntu 22.04.2 LTS 5.15.0-73-generic containerd://1.6.15