CentOSLinuxTutorials

How To Install MicroK8s on CentOS 8

Install MicroK8s on CentOS 8

In this tutorial, we will show you how to install MicroK8s on CentOS 8. For those of you who didn’t know, MicroK8s is a small, fast, single-package Kubernetes for developers, IoT, and edge. One command installs a single-node K8s cluster with carefully selected add-ons on Linux, Windows, and macOS. MicroK8s requires no configuration, supports automatic updates and GPU acceleration. Use it for offline development, prototyping, testing, to build your CI/CD pipeline or your IoT apps.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the MicroK8s on a CentOS 8.

Prerequisites

  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install MicroK8s on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf update
sudo dnf install epel-release

Step 2. Enable Snaps.

Run the following command below to install and enable Snap to your system:

sudo dnf install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Step 3. Installing MicroK8s on CentOS 8.

MicroK8s can easily be installed on CentOS 8 using Snap. To install MicroK8s, simply use the following command:

sudo snap install microk8s --classic

Once installing MicroK8s, it is running automatically. To stop or start it, set it like follows:

# show status

[root@idroot.us ~]# microk8s status

microk8s is running
addons:
ambassador: disabled
cilium: disabled
dashboard: disabled
dns: disabled
fluentd: disabled
gpu: disabled
helm: disabled
helm3: disabled
host-access: disabled
ingress: disabled
istio: disabled
jaeger: disabled
knative: disabled
kubeflow: disabled
linkerd: disabled
metallb: disabled
metrics-server: disabled
multus: disabled
prometheus: disabled
rbac: disabled
registry: disabled
storage: disabled

# show config

[root@idroot.us ~]# microk8s config

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

[root@idroot.us ~]# microk8s kubectl get all

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.152.183.1           443/TCP   81s

[root@idroot.us ~]# microk8s kubectl get nodes

NAME            STATUS   ROLES    AGE   VERSION
micro.idroot.us   Ready       95s   v1.18.6-1+64f53401f200a7

# stop MicroK8s

[root@idroot.us ~]# microk8s stop

stop of [microk8s.daemon-apiserver microk8s.daemon-apiserver-kicker microk8s.da…
Stopped.
[root@idroot.us ~]# microk8s status

microk8s is not running. Use microk8s inspect for a deeper inspection.
# start MicroK8s

[root@idroot.us ~]# microk8s start

Started.
# disable MicroK8s

[root@idroot.us ~]# snap disable microk8s

microk8s disabled
# enable MicroK8s

[root@idroot.us ~]# snap enable microk8s

microk8s enabled

Step 4. Configure Firewall.

If your machine is behind a firewall, the MicroK8s server port may be blocked. Thus, you need to adjust firewall settings to allow MicroK8s port:

sudo firewall-cmd --permanent --add-port={10255,12379,25000,16443,10250,10257,10259,32000}/tcp
sudo firewall-cmd --reload

Congratulations! You have successfully installed MicroK8s. Thanks for using this tutorial for installing the MicroK8s on your CentOS 8 system. For additional help or useful information, we recommend you check the official MicroK8s website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button