Tue. Jan 18th, 2022

Make sure you burn the os (I use Ubuntu Server any LTS version) to a SD Card then boot to your RPi4 device -> RPi imager (https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb)

1 – sudo systemctl stop ufw
2 – sudo systemctl disable ufw
3 – sudo timedatectl set-timezone America/New_York
4 – sudo nano -c /etc/hostname

<FQDN Here>

5 – sudo nano -c /etc/hosts kubepoc1.cfs.loc kubepoc1 kubepoc2.cfs.loc kubepoc2 kubepoc3.cfs.loc kubepoc3

Update the Repo and upgrade the system and turn swap off

6 – sudo swapoff -a
7 – sudo apt update
8 – sudo apt -y full-upgrade
9 – sudo reboot

Create the SSH Keys and copy them to participating systems

10 – sudo ssh-keygen
11 – sudo ssh-copy-id -i ~/.ssh/id_rsa @srvr.ip.add

STORAGE you have to run this commend on all nodes.

12 – sudo systemctl enable –now iscsid

Install nfs-common on master and worker nodes

13 – sudo apt -y install nfs-common

Install Kubernetes (microk8s)

18 – sudo snap install microk8s –classic –channel=1.21/stable or –channel=1.22/stable
19 – sudo microk8s status

STORAGE Alternative storage for NFS instead of openebs

20 – sudo microk8s helm3 repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
21 – sudo microk8s helm3 install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
–set nfs.server=xxx.xxx.xxx.xxx \
–set nfs.path=/export/path/here

Remove microk8s-hostpath as default storageclass

22 – sudo microk8s kubectl patch storageclass microk8s-hostpath -p ‘{“metadata”: {“annotations”:{“storageclass.kubernetes.io/is-default-class”:”false”}}}’

set the NFS-Client as defult storageclass

23 – sudo microk8s kubectl patch storageclass nfs-client -p ‘{“metadata”: {“annotations”:{“storageclass.kubernetes.io/is-default-class”:”true”}}}’

run these to make sure you set the user

24 – sudo usermod -a -G microk8s cfadmin
25 – sudo chown -f -R cfadmin ~/.kube

Stop here and go to the Worker node installs

26 – sudo microk8s.enable dns dashboard helm3 ingress rbac storage portainer

On Master Node

27 – sudo microk8s add-node
28 – sudo microk8s kubectl get node
29 – sudo snap info microk8s

Install on Worker node

sudo snap install microk8s –classic –channel=1.21/stable

sudo microk8s join <token from #27

Portainer Business Install

sudo microk8s helm3 install –create-namespace -n portainer portainer portainer/portainer-ee –set enterpriseEdition.enabled=true

Portainer Community Install

sudo microk8s.enable portainer

Portainer Agent Install Only

sudo curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml

sudo microk8s.kubectl apply -f portainer-agent-k8s.yaml

note: If you are doing this on a Pi please got to that article and follow it: MicroK8s on a Pi

So as far as I know this should be the end of the process for both Kubernetes and Portainer Server / Portainer-Agent. Please let us know if you need help. You may send us a request via the contact page.

Thank you for reading,

RPi Hobby Blog

By cfadmin

Leave a Reply

Your email address will not be published. Required fields are marked *