samayly.com is live. Hosted plans open soon. Join the waitlist →
yaml82 linescopy and edit

k8s/waha.yaml

Copy this file into your setup and edit the marked values. Do not use it as-is.

k8s/waha.yaml
# WAHA (WhatsApp HTTP API) on a local k3d cluster, reachable only on 127.0.0.1:<host-port>.
# Secrets are NOT in this file. Create them first (see docs/11):
#   kubectl -n waha create secret generic waha-secrets \
#     --from-literal=WAHA_API_KEY="$WAHA_KEY" --from-literal=HOOK_SECRET="$HOOK_SECRET"
#
# Apple Silicon: image devlikeapro/waha:arm   ·   Intel Macs / x86: devlikeapro/waha:latest
# Webhook host: host.k3d.internal reaches the Mac from inside k3d (test it: docs/11, step 9)
apiVersion: v1
kind: Namespace
metadata:
  name: waha
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: waha-sessions
  namespace: waha
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: waha
  namespace: waha
  labels: { app: waha }
spec:
  replicas: 1                      # one WhatsApp session = exactly one pod
  strategy:
    type: Recreate                 # never run two pods on the same session (they log each other out)
  selector:
    matchLabels: { app: waha }
  template:
    metadata:
      labels: { app: waha }
    spec:
      containers:
        - name: waha
          image: devlikeapro/waha:arm
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 3000
          env:
            - name: WAHA_API_KEY
              valueFrom: { secretKeyRef: { name: waha-secrets, key: WAHA_API_KEY } }
            - name: HOOK_SECRET
              valueFrom: { secretKeyRef: { name: waha-secrets, key: HOOK_SECRET } }
            - name: WHATSAPP_HOOK_URL
              value: "http://host.k3d.internal:5055/hook/$(HOOK_SECRET)"   # $(VAR) = k8s env substitution
            - name: WHATSAPP_HOOK_EVENTS
              value: "message.any"   # "message" alone misses messages sent by the linked account itself
          volumeMounts:
            - name: sessions
              mountPath: /app/.sessions
          resources:
            requests: { cpu: 100m, memory: 256Mi }
            limits: { memory: 1Gi }
          readinessProbe:
            tcpSocket: { port: 3000 }
            initialDelaySeconds: 10
            periodSeconds: 10
      volumes:
        - name: sessions
          persistentVolumeClaim:
            claimName: waha-sessions
---
apiVersion: v1
kind: Service
metadata:
  name: waha
  namespace: waha
spec:
  type: NodePort
  selector: { app: waha }
  ports:
    - port: 3000
      targetPort: 3000
      nodePort: 30000              # k3d maps 127.0.0.1:<host-port> -> this NodePort

Questions or corrections: [email protected]