Quick and Easy Kubernetes Cluster setup

:

These are my k3s notes, this post needs more work but noting down what I have done

What is k3s?

K3s is a lightweight Kubernetes distribution created by Rancher Labs, and it is fully certified by the Cloud Native Computing Foundation (CNCF). K3s is highly available and production-ready. It has a very small binary size and very low resource requirements.

Requirements

  • I tested this on Oracle Linux 7.9 as well as k3os but it should run on everything
  • A couple of VM’s

Open up the Firewall for k3s

Firewall Rules
firewall-cmd –permanent –add-port=22/tcp
firewall-cmd –permanent –add-port=80/tcp
firewall-cmd –permanent –add-port=443/tcp
firewall-cmd –permanent –add-port=2376/tcp
firewall-cmd –permanent –add-port=2379/tcp
firewall-cmd –permanent –add-port=2380/tcp
firewall-cmd –permanent –add-port=6443/tcp
firewall-cmd –permanent –add-port=8472/udp
firewall-cmd –permanent –add-port=9099/tcp
firewall-cmd –permanent –add-port=10250/tcp
firewall-cmd –permanent –add-port=10254/tcp
firewall-cmd –permanent –add-port=30000-32767/tcp
firewall-cmd –permanent –add-port=30000-32767/udp

firewall-cmd –reload

export INSTALL_K3S_SKIP_SELINUX_RPM=true
export INSTALL_K3S_SELINUX_WARN=true

Create the master node

curl -sfL https://get.k3s.io | sh –

Get the node token of the master node

cat /var/lib/rancher/k3s/server/node-token

Join the Worker to the master node

curl -sfL https://get.k3s.io | K3S_URL=https://ipofmasternode:6443 K3S_TOKEN=<insert token here> sh –

run kubectl get nodes, if both say ready your cluster is up.

Install Portainer

Portainer seems to be quite a good way to manage this infrastructure as well as get to grips with the backend

To install it run:

kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml

It should now be available on https://clusterip:37000

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s