-
-
Save pew/3d99a1d2bf06ae64dd64fd6cfaf7f83a to your computer and use it in GitHub Desktop.
kubernetes / k8s cloudflare tunnel deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
tunnel: cf-tunnel | |
name: cf-tunnel | |
namespace: default | |
spec: | |
replicas: 4 # you might want to adjust the replicas to your own needs | |
selector: | |
matchLabels: | |
tunnel: cf-tunnel | |
strategy: | |
rollingUpdate: | |
maxSurge: 0 | |
maxUnavailable: 1 | |
template: | |
metadata: | |
labels: | |
tunnel: cf-tunnel | |
spec: | |
containers: | |
- args: | |
- tunnel | |
- --no-autoupdate | |
- --metrics | |
- 0.0.0.0:8081 | |
- run | |
- --token | |
- $(token) | |
envFrom: | |
- secretRef: | |
name: cf-tunnel | |
env: | |
- name: TZ | |
value: UTC | |
image: cloudflare/cloudflared:latest # you might want to pin this to a version | |
imagePullPolicy: Always | |
livenessProbe: | |
failureThreshold: 3 | |
httpGet: | |
path: /ready | |
port: 8081 | |
initialDelaySeconds: 10 | |
periodSeconds: 10 | |
name: tunnel | |
ports: | |
- containerPort: 8081 | |
name: http-metrics | |
--- | |
apiVersion: v1 | |
data: | |
token: <cloudflare authentication token base64 encoded> | |
kind: Secret | |
metadata: | |
name: cf-tunnel | |
namespace: default | |
type: Opaque |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you could simplify this config a bit by choosing the environment variable
TUNNEL_TOKEN
instead oftoken
. In that case, you don't need to pass the option--tunnel
and delete lines 29 and 30.