Adding storage to our homelab application

In order to persist any data that will be generated be linkding, we need to make sure that we have persistent storage.

First we need to provision a PVC.

#base/linkding/pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: linkding-pv-claim
  namespace: linkding
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

And then alter our deployment to add the volume and mount it to the container.

#base/linkding/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: linkding
spec:
  replicas: 1
  selector:
    matchLabels:
      app: linkding
  template:
    metadata:
      labels:
        app: linkding
    spec:
      containers:
        - name: linkding
          image: sissbruecker/linkding:1.31.0
          ports:
            - containerPort: 9090
          volumeMounts:
            - name: linkding-data
              mountPath: "/etc/linkding/data"
      volumes:
        - name: linkding-data
          persistentVolumeClaim:
            claimName: linkding-data-pvc

With Flux running in our cluster all we need to do is to commit and push our changes to the homelab repo! 💥