Wallabag in k8s

I will just the most simple description of resources, plain Kubernetes manifests.

You can build your own Helm Charts, use kustomize or whatever.

Prerequites

Manifests

---
apiVersion: v1
kind: Namespace
metadata:
  name: wallabag
---
apiVersion: v1
kind: Secret
metadata:
  name: docker-hub-secret
  namespace: wallabag
data:
  .dockerconfigjson: <set your own docker-hub token here>
type: kubernetes.io/dockerconfigjson

Database

Wallabag needs a database, so I start with one:

---
apiVersion: v1
kind: Secret
type: kubernetes.io/basic-auth
metadata:
  name: cl-wallabag-wallabag
  namespace: wallabag
data:
  username: <set your database username here>
  password: <set your database password here>
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: postgresql-wallabag
  namespace: wallabag
spec:
  instances: 1
  primaryUpdateStrategy: unsupervised
  storage:
    size: 2Gi
    pvcTemplate:
      accessModes:
        - ReadWriteOnce
      storageClassName: synology-iscsi-storage
      volumeMode: Filesystem
  bootstrap:
    initdb:
      database: <set your database name here, match to the secret>
      owner: <set your database username here, match to the secret above>
      dataChecksums: true
      encoding: "UTF8"
  managed:
    roles:
      - name: <set your database username here, match to the secret above>
        createdb: true
        login: true
        comment: wallabag user
        superuser: false
        createrole: false
        inRoles:
          - pg_monitor
          - pg_signal_backend
        passwordSecret:
          name: cl-wallabag-wallabag

This will create a PostgreSQL cluster named postgresql-wallabag that uses a 2GB volume.

Wallabag

Create some volume for Wallabag.

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wallabag-data-claim
  namespace: wallabag
spec:
  storageClassName: synology-iscsi-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
  volumeMode: Filesystem

Configure App-Secret and configure the Container with environment variables.

Documentation on the paramters of the Container image are here: https://hub.docker.com/r/wallabag/wallabag

---
apiVersion: v1
kind: Secret
metadata:
  name: wallabag-secret
  namespace: wallabag
type: Opaque
data:
  wallabag-database: <set your database name here>
  env-secret: <set some random string>
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wallabag
  namespace: wallabag
  labels:
    app: wallabag
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wallabag
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wallabag
    spec:
      containers:
        - name: wallabag
          image: wallabag/wallabag:2.6.12
          ports:
            - containerPort: 80
          resources:
            requests:
              memory: "64Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          env:
            - name: SYMFONY__ENV__DATABASE_DRIVER
              value: "pdo_pgsql"
            - name: SYMFONY__ENV__DATABASE_HOST
              value: "postgresql-wallabag-rw"
            - name: SYMFONY__ENV__DATABASE_PORT
              value: "5432"
            - name: SYMFONY__ENV__DATABASE_NAME
              valueFrom:
                secretKeyRef:
                  name: wallabag-secret
                  key: wallabag-database
            - name: SYMFONY__ENV__DATABASE_USER
              valueFrom:
                secretKeyRef:
                  name: cl-wallabag-wallabag
                  key: username
            - name: SYMFONY__ENV__DATABASE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: cl-wallabag-wallabag
                  key: password
            - name: SYMFONY__ENV__SECRET
              valueFrom:
                secretKeyRef:
                  name: wallabag-secret
                  key: env-secret
            - name: SYMFONY__ENV__LOCALE
              value: de
            - name: SYMFONY__ENV__DOMAIN_NAME
              value: "<enter your fqdn for Wallabag here>"
            - name: SYMFONY__ENV__SERVER_NAME
              value: "Wallabag"
            - name: PHP_MEMORY_LIMIT
              value: "256M"
---
apiVersion: v1
kind: Service
metadata:
  name: wallabag
  namespace: wallabag
spec:
  selector:
    app: wallabag
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80

Optional: Tailscale

Expose your Wallabag instance via the Tailscale-Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: wallabag
  namespace: wallabag
spec:
  defaultBackend:
    service:
      name: wallabag
      port:
        number: 80
  ingressClassName: tailscale
  tls:
    - hosts:
        - wallabag

Final initialisation of Wallabag

For the initial bootstrap of Wallabag you’ve to execute this command in your Container / Pod:

php bin/console wallabag:install --env=prod

For example with some command like

kubectl exec -n wallabag <wallabag pod name> -it -- php bin/console wallabag:install --env=prod

Your application is now ready for use.