This is the repo for my homelab kubernetes (k3s) cluster. Its main purpose is to self-host useful applications for everyday life and to learn more about kubernetes.
At the moment my homelab consists of:
- 3x Lenovo ThinkCentre M710q (16 GB RAM, 256 GB SSD)
- 1x NAS (Buffalo Linkstation)
- 1x 8-port Switch Linksys LGS108
Since i just started with kubernetes i will document the setup here.
More information can be found on my website: https://chutzinger.com/homelab/ (work in progress)
Currently i am using the following components:
- k3s
- SMB CSI Driver for Kubernetes
- Technitium DNS Server
curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/v1.19.1/deploy/install-driver.sh | bash -s v1.19.1 --kubectl create secret generic smbcreds --from-literal username=<username> --from-literal password="<password>"apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: smb.csi.k8s.io
name: pv-smb
spec:
capacity:
storage: 9Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: smb
mountOptions:
- dir_mode=0777
- file_mode=0777
- vers=1.0
csi:
driver: smb.csi.k8s.io
volumeHandle: nas.default.svc.cluster.local/#kubernetes#kubernetes
volumeAttributes:
source: //nas/kubernetes
nodeStageSecretRef:
name: smbcreds
namespace: defaultkind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-smb
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 9Gi
volumeName: pv-smb
storageClassName: smbkubectl apply -f pvc-buffalo.yamlkubectl get pv
kubectl get pvcThe deployment is pretty straight forward. The only thing to note is that it uses the PVC (persistent volume claim) i created before to mount the SMB share.
apiVersion: apps/v1
kind: Deployment
metadata:
name: technitium
spec:
selector:
matchLabels:
app: technitium
replicas: 1
template:
metadata:
labels:
app: technitium
spec:
containers:
- name: technitium
image: technitium/dns-server:14.3.0
volumeMounts:
- name: technitium-volume
mountPath: /etc/dns
subPath: technitium
volumes:
- name: technitium-volume
persistentVolumeClaim:
claimName: pvc-smb To get the DNS server publicly available on port 5380 i created a LoadBalancer service.
kind: Service
apiVersion: v1
metadata:
name: technitium-loadbalancer
spec:
ports:
- name: technitium-udp
port: 53
targetPort: 53
protocol: UDP
- name: technitium-tcp
port: 53
targetPort: 53
protocol: TCP
- name: technitium-http
port: 5380
targetPort: 5380
protocol: TCP
selector:
app: technitium
type: LoadBalancerkubectl apply -f technitium.yamlkubectl get deploymentsMIT License