Home » K8s Stacks @Tim Bai’s Zone » TiddlyWiki on K8s

TiddlyWiki on K8s

The K8s Deployment for TiddlyWiki

Tiddlywiki is a personal wiki, it was used as an extension to my blog to link unstructured knowledge.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: tiddly-pv-claim-1
  labels:
    app: tiddlywiki
    tier: frontend
spec:
  storageClassName: local-path
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tiddlywiki
  labels:
    app: tiddlywiki
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tiddlywiki
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: tiddlywiki
        tier: frontend
    spec:
      nodeSelector:
        kubernetes.io/arch: amd64
      containers:
      - image: tim010/tiddlywiki-public:5.1.23
        name: tiddlywiki
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        env:
        - name: USERNAME
          value: user
        - name: NODE_ENV
          value: '1024'
        - name: PASSWORD
          valueFrom:
            secretKeyRef:
              name: default-secrets
              key: tiddly_pwd
        ports:
        - containerPort: 8080
          name: tiddlywiki
        volumeMounts:
        - name: tiddlywiki-persistent-storage
          mountPath: /var/lib/tiddlywiki
      volumes:
      - name: tiddlywiki-persistent-storage
        persistentVolumeClaim:
          claimName: tiddly-pv-claim-1

---
apiVersion: v1
kind: Service
metadata:
  name: tiddlywiki-service
  labels:
    app: tiddlywiki
    tier: frontend
spec:
  ports:
    - name: http
      port: 8080
  selector:
    app: tiddlywiki
    tier: frontend

---

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: tiddlywiki-ingress
  labels:
    app: tiddlywiki
    tier: frontend
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/redirect-entry-point: https
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  tls:
    - hosts:
        - wiki.mydomain.com
      secretName: cert-tls
  rules:
    - host: wiki.mydomain.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: tiddlywiki-service
                port:
                  number: 8080

It requires a volume and an environment variable for the login password (as you can see in the k8s deployment config above), the docker image is one image I modified to support login.

More about tiddlywiki

knowledge sharing with notes like an wiki page