Skip to content

Instantly share code, notes, and snippets.

@jkpe
Created June 17, 2024 07:31
Show Gist options
  • Save jkpe/14d911589f8edbd6b57b0f0e42aba76a to your computer and use it in GitHub Desktop.
Save jkpe/14d911589f8edbd6b57b0f0e42aba76a to your computer and use it in GitHub Desktop.
Cloudflare Tunnel Deployment on K8s
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: cloudflared
name: cloudflared-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
pod: cloudflared
template:
metadata:
creationTimestamp: null
labels:
pod: cloudflared
spec:
containers:
- command:
- cloudflared
- tunnel
# In a k8s environment, the metrics server needs to listen outside the pod it runs on.
# The address 0.0.0.0:2000 allows any pod in the namespace.
- --metrics
- 0.0.0.0:2000
- run
args:
- --token
- <token value>
image: cloudflare/cloudflared:latest
name: cloudflared
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment