--- apiVersion: apps/v1 kind: Deployment metadata: name: cloudflared spec: selector: matchLabels: app: cloudflared replicas: 3 template: metadata: labels: app: cloudflared spec: containers: - name: cloudflared image: cloudflare/cloudflared:2024.2.1 args: - tunnel - --config - /etc/cloudflared/config/config.yaml - run ports: - containerPort: 2000 name: metrics livenessProbe: httpGet: # Cloudflared has a /ready endpoint which returns 200 if and only if # it has an active connection to the edge. path: /ready port: 2000 failureThreshold: 1 initialDelaySeconds: 10 periodSeconds: 10 volumeMounts: - name: config mountPath: /etc/cloudflared/config readOnly: true - name: creds mountPath: /etc/cloudflared/creds readOnly: true volumes: - name: creds secret: secretName: tunnel-credentials - name: config configMap: name: cloudflared items: - key: config.yaml path: config.yaml --- apiVersion: v1 kind: Service metadata: name: cloudflared-metrics spec: selector: app: cloudflared ports: - name: metrics port: 2000 targetPort: 2000 --- apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: cloudflared labels: release: prometheus spec: selector: matchLabels: app: cloudflared podMetricsEndpoints: - port: metrics interval: 30s