apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: badges-cloudflared
  name: badges-cloudflared-deployment
  namespace: apps
spec:
  replicas: 1
  selector:
    matchLabels:
      pod: badges-cloudflared
  template:
    metadata:
      labels:
        pod: badges-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
        - eyJhIjoiZDM5YjVhY2E0MzkxNjQ2MDJjMDFmN2FmMmE1OGQ0YmYiLCJ0IjoiOTAxOWE2NWItMWVkMS00M2IzLWI1ZjEtMmI2YzhkNjk4M2UxIiwicyI6Ik5HSXhNRFZoTkRRdFpEUmhNeTAwWXpZNUxUa3lOVEl0TURFNFlUTTNNekk1T1dRMyJ9
        image: cloudflare/cloudflared:latest
        name: badges-cloudflared
        livenessProbe:
          httpGet:
          # Badges-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
