kind: Deployment
apiVersion: apps/v1
metadata:
  name: openvpn-client
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: openvpn-client
  template:
    metadata:
      labels:
        app: openvpn-client
    spec:
      automountServiceAccountToken: false
      containers:
      - name: openvpn-client
        image: quay.io/sjenning/poc:openvpn
        imagePullPolicy: Always
        command:
        - /bin/bash
        args:
        - -c
        - |-
          #!/bin/bash
          set -eu
          iptables -t nat -A POSTROUTING -s 192.168.255.0/24 -j MASQUERADE
          exec /usr/sbin/openvpn --config /etc/openvpn/client.conf
        workingDir: /etc/openvpn
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /etc/openvpn
          name: secret
        - mountPath: /lib/modules
          name: host-modules
          readOnly: true
      volumes:
      - secret:
          secretName: openvpn-client
        name: secret
      - hostPath:
          path: /lib/modules
        name: host-modules
