I have decided to start my #100daysofhomelab journey again, so today is day 1. I have been working on a K3s cluster in the house, and so far, I have to start again… going to rebuild it again tomorrow at some stage…
Lots of Links
- techno-tim/k3s-ansible: The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more (github.com)
- Cloud Native Distributed Storage in Kubernetes with Longhorn | Techno Tim Documentation
- High Availability Rancher on kubernetes | Techno Tim Documentation
- Create Longhorn Volumes
- The Ultimate Kubernetes Homelab Guide: From Zero to Production Cluster On-Premises (datastrophic.io)
- Configuring Traefik 2 Ingress for Kubernetes | Techno Tim Documentation
- HIGH AVAILABILITY k3s (Kubernetes) in minutes! | Techno Tim Documentation
- kubernetes | Techno Tim Documentation
- Beautiful Dashboards with Grafana and Prometheus – Monitoring Kubernetes Tutorial | Techno Tim Documentation
some notes for myself:
Service Account for Dashboard
to create the Service account, create a file, ca.yml, and enter the following:
apiVersion: v1
kind: ServiceAccount
metadata:
name: <username>
namespace: kube-system
next, create a file called cluster-role-binding.yml with the following:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: <username>
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: <username>
namespace: kube-system
make sure username matches!
run the following commands:
kubectl apply -f sa.yml
kubectl apply -f cluster-role-binding.yml
kubectl -n kube-system create token <username>
Installing OpenSCSI and NFS (required for Longhorn) with Ansible
Ansible Script
---
- hosts: k3s
become: true
tasks:
- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 600
- name: install packages
become: true
apt:
pkg:
- nfs-common
- open-iscsi
- name: Make sure open-iscsi is enabled and running
ansible.builtin.systemd:
enabled: true
state: started
name: open-iscsi
---
This site is hosted on my own ASN on AS204994. More details about that over there. I also use Vultr for transit services and HostUs for LIR Services. Check them out. You can also check some of the gear I use on a daily basis over on kit.co/tiernano. Looking for a Backup Option? Check out Backblaze and get a month free.