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
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