Skip to content

Draw.io (Diagrams.net) on k3s

Drawio is one of those tools I actually tend to use. It is great for flow charts, mind maps or floor design. you draw up what you need and then download via pdf.

  • Persistent storage for config
  • Static IP via MetalLB

Create Namespace

kubectl create namespace tools

Create Persistent Volume (PVC)

Note: The official image is stateless, but you can add volume mounts if needed for custom configs or static files.

Save as drawio-pvc.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: drawio-config
  namespace: tools
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: longhorn

Apply it:

kubectl apply -f drawio-pvc.yaml

Create Deployment and Service

Save the following as drawio.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drawio
  namespace: tools
spec:
  replicas: 1
  selector:
    matchLabels:
      app: drawio
  template:
    metadata:
      labels:
        app: drawio
    spec:
      containers:
        - name: drawio
          image: jgraph/drawio:latest
          ports:
            - containerPort: 8080
          # Optional volume mount
          volumeMounts:
            - name: drawio-storage
              mountPath: /data
      volumes:
        - name: drawio-storage
          persistentVolumeClaim:
            claimName: drawio-config
---
apiVersion: v1
kind: Service
metadata:
  name: drawio
  namespace: tools
spec:
  selector:
    app: drawio
  type: LoadBalancer
  loadBalancerIP: 10.0.0.36
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080

Apply it:

kubectl apply -f drawio.yaml

🌐 4. Access draw.io

  • LAN Access: Visit http://10.0.0.36

Published inKubernetes