apiVersion: v1
kind: Pod
metadata:
  name: proxy
spec:
  serviceAccountName: tailscale
  initContainers:
  - name: sysctler
    image: busybox
    securityContext:
      privileged: true
    command: ["/bin/sh"]
    args:
      - -c
      - sysctl -w net.ipv4.ip_forward=1
    resources:
      requests:
        cpu: 1m
        memory: 1Mi
  containers:
  - name: tailscale
    imagePullPolicy: Always
    image: "{{IMAGE_TAG}}"
    env: 
    # Store the state in a k8s secret
    - name: KUBE_SECRET
      value: "tailscale"
    - name: USERSPACE
      value: "false"
    - name: AUTH_KEY
      valueFrom:
        secretKeyRef:
          name: tailscale-auth
          key: AUTH_KEY
          optional: true
    - name: DEST_IP
      value: "{{DEST_IP}}"
    securityContext:
      capabilities:
        add:
        - NET_ADMIN