Skip to content

chutzinger/homelab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomeLab

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

Setup

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

NAS (Buffalo Linkstation)

SMB CSI Driver for Kubernetes

Install

curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/v1.19.1/deploy/install-driver.sh | bash -s v1.19.1 --

Create secret

kubectl create secret generic smbcreds --from-literal username=<username> --from-literal password="<password>"

Creating the PersistentVolume

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

Creating the PersistentVolumeClaim

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-smb
  namespace: default
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 9Gi
  volumeName: pv-smb
  storageClassName: smb

Apply & verify changes

kubectl apply -f pvc-buffalo.yaml
kubectl get pv
kubectl get pvc

DNS Server

Technitium DNS Server

Creating the Deployment

The 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  

Creating the LoadBalancer service

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

Apply changes & verify

kubectl apply -f technitium.yaml
kubectl get deployments

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors