Skip to main content

Kubernetes cluster setup

·243 words·2 mins
Author
Ian Blockmans
I make things and also virtual things

info
#

Cluster ip = 10.0.11.0

Setup cluster
#

OS
#

start with a ubuntu server setup nothing special. consider setting up ssh keys.

install k3sup
#

Follow documentation on their website.

k3s install first server (wls)
#

k3sup install \
--ip 10.0.11.1 \
--tls-san kube.ian.lan \
--tls-san 10.0.11.0 \
--cluster \
--k3s-channel latest \
--k3s-extra-args "--disable=servicelb --disable=traefik" \
--local-path ~/.kube/config \
--user ian \
--merge

k3s install other node servers
#

k3sup join \
--ip 10.0.11.2 \
--server-ip 10.0.11.1 \
--server \
--k3s-channel latest \
--k3s-extra-args "--disable=servicelb --disable=traefik" \
--user ian

changing launch arguments after the fact
#

Edit /etc/systemd/system/k3s.service

Install dependencies nfs-common for nfs share use
#

apt-get install open-iscsi nfs-common

kube-vip Loadbalancer
#

install
#

follow documentation leave everting default. (https://kube-vip.io/docs/installation/daemonset/)

service ip
#

Add --type=LoadBalancer to deployment to give the service an ip address or under spec: add type: LoadBalancer tag. Or in helm values yaml you can also add it like this: (depends on helm chart)

service:
  spec:
    type: LoadBalancer
    loadBalancerIP: 10.0.20.1 ## optional

loadbalancer ip change
#

adding an ip to the cluster cert k3s server --tls-san "<your-desired-ip>"

gitops
#

flux bootstrap command
#

flux bootstrap git --url=ssh://[email protected]:38522/homelab/homelab --branch=main --path=clusters/homelab --token-auth=false --private-key-file=./.ssh/id_rsa

gitlab bootstrap command
#

glab cluster agent bootstrap --manifest-path clusters/homelab homelab

deploying with flux
#

Just add the kubernetes yaml configuration files to the clusters/homelab folder on my homelab repo.

Topology
#

topology

Useful resources
#

Related

Resume
·288 words·2 mins
Homelab resources
·80 words·1 min
Monitoring with Grafana
·568 words·3 mins