Miniflux 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
- Some k8s-cluster, here: K3S, https://k3s.io, with these items installed and configured:
- CNPG, https://cloudnative-pg.io
- a configured StorageClass, here https://github.com/SynologyOpenSource/synology-csi
- Tailscale (optional)
Manifests
---
apiVersion: v1
kind: Namespace
metadata:
name: miniflux
---
apiVersion: v1
kind: Secret
metadata:
name: docker-hub-secret
namespace: miniflux
data:
.dockerconfigjson: <set your own docker-hub token here>
type: kubernetes.io/dockerconfigjson
Secrets
Use only one secret for the database configuration and the application itself.
---
apiVersion: v1
kind: Secret
type: kubernetes.io/basic-auth
metadata:
name: cl-miniflux-server
namespace: miniflux
data:
username: <your database-user>
password: <your database-password>
# db-string-format: postgres://db-user:db-password@<hostname>/<db-name>?sslmode=disable
# example: db-string-format: postgres://db-user:db-password@postgresql-miniflux-rw/miniflux?sslmode=disable
db-string: <your db-connection string>
miniflux-admin: <your miniflux admin user>
miniflux-admin-password: <xour miniflux admin password>
Database
Miniflux needs a database, so I start with one:
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgresql-miniflux
namespace: miniflux
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: miniflux user
superuser: false
createrole: false
inRoles:
- pg_monitor
- pg_signal_backend
passwordSecret:
name: cl-miniflux-miniflux
This will create a PostgreSQL cluster named postgresql-miniflux
that uses a 2GB volume.
Miniflux
Create some volume for Miniflux.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: miniflux-data-claim
namespace: miniflux
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/miniflux/miniflux (or https://ghcr.io/miniflux/miniflux or https://quay.io/miniflux/miniflux)
---
apiVersion: v1
kind: Namespace
metadata:
name: miniflux
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: miniflux
name: miniflux
namespace: miniflux
spec:
replicas: 1
selector:
matchLabels:
app: miniflux
template:
metadata:
labels:
app: miniflux
spec:
containers:
- image: quay.io/miniflux/miniflux
name: miniflux
env:
- name: RUN_MIGRATIONS
value: "1"
- name: CREATE_ADMIN
value: "1"
- name: ADMIN_USERNAME
valueFrom:
secretKeyRef:
name: cl-miniflux-server
key: miniflux-admin
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: cl-miniflux-server
key: miniflux-admin-password
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: cl-miniflux-server
key: db-string
ports:
- name: http
containerPort: 8080
resources:
limits:
cpu: 500m
memory: 1000Mi
imagePullSecrets:
- name: docker-hub-secret
---
apiVersion: v1
kind: Service
metadata:
name: miniflux
namespace: miniflux
spec:
selector:
app: miniflux
ports:
- protocol: TCP
port: 8080
name: http
Optional: Tailscale
Expose your Miniflux instance via the Tailscale-Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: miniflux
namespace: miniflux
spec:
defaultBackend:
service:
name: miniflux
port:
number: 8080
ingressClassName: tailscale
tls:
- hosts:
- miniflux
Your application is now ready for use.
More config options: https://miniflux.app/docs/configuration.html