Computers Can Be Fun

bookstackapp

BookStack Github Stats

I decided to deploy a wiki application to the Kubernetes cluster to have a place to store documentation for research, new projects, and existing system architectures. I found BookStatck to be simple to use and provided a nice test app to get running in the K3s cluster.

BookStack will run in two pods each with dedicated storage. A Pod consisted of one or more Containers and is the smallest unit of work in Kubernetes. While use cases do exist for multiple Containers in a Pod, normally, only one is assigned. I will be creating a Pod for BookStacks backend SQL database as well as a Pod for the frontend web application. These Pods will each have dedicated storage, provisioned with Longhorn.

MariaDB will be used for the SQL database. A PersistentVolumeClaim will be used to allocated disk space.

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    storage: bookstack-db-storage
  name: bookstack-db-storage
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: longhorn

A second PVC will be used for the BookStack's frontend. This storage will be for file uploads and attachments.

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    storage: bookstack-storage
  name: bookstack-storage
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: longhorn

The configuration accessModes: ReadWriteOnce instructs the cluster that only one worker node is allowed to mount and write to this volume.

Apply the yaml configuration with kubectl.

control-01:~/apps/bookstack$ kubectl apply -f bookstack-db-storage.yaml -f bookstack-storage.yaml

Read more...