personal-ovpn

by suda

Helm chartv0.2.2App 2.4Verified publisher

Roll your own OpenVPN server

About this chart

Private Kubernetes OpenVPN Helm chart

TL;DR: This Chart is intended for deploying a private VPN server without access to other Pods in the cluster. Think of it as roll-your-own Nord/Express VPN in your Kubernetes cluster.

Usage

$ helm repo add suda https://suda.github.io/charts/
$ helm repo update
$ helm install suda/personal-ovpn

Skip manual steps: Automatic and Insecure way (not for production)

$ helm repo add suda https://suda.github.io/charts/
$ helm repo update
$ helm install suda/personal-ovpn --set automatic.enabled=true

Generate necessary secrets (manual way & secure CA)

$ git clone https://github.com/suda/charts.git
$ cd charts
$ export VPN_HOSTNAME=vpn.example.com
# Generate basic OpenVPN config
$ ./bin/generate-config
# Repeat this step for all the clients you need
$ CLIENT_NAME=my-client ./bin/add-client
# Set the Kubernetes secrets. Prepend with REPLACE=true to update existing ones
$ ./bin/set-secrets

After generating the secrets above, you'll have all the config, certificates and the keys on your machine, in the ovpn0 directory. You need it to add more clients later but also isn't very secure to keep those keys just laying around on your machine.

Allowing traffic inside of the cluster

If you want to make debugging the cluster easier and use VPN to access the pods, you might prefer using stable/openvpn chart. But if you really want to, you can enable it by setting limitTraficToNamespace value to false.

Maintainers

NameEmailUrl
suda[email protected]

Values

KeyTypeDefaultDescription
affinityobject{}node/pod affinities (requires Kubernetes >=1.6)
automatic.cipherstring"AES-256-CBC"Cipher used
automatic.digestAlgorythmstring"SHA384"Authenticate packets with HMAC using the given message digest algorithm (auth).
automatic.dnsServerstring"8.8.8.8"DNS Server IP
automatic.enabledboolfalseSkip manual steps and generate configuration & pki according to values config, Warning, PKI will be passwordless !
automatic.externalHostnamestring""Hostname OR Ip of cluster openvpn entrypoint, default to 'domain.tld' so you must define it
automatic.externalPortstring""Port cluster openvpn entrypoint, defaults to service.port (nodePort)
automatic.extraOptionslist[]Additional options for openvpn configuration
automatic.persistence.accessModeslist["ReadWriteOnce"]PersistentVolumeClaim access modes
automatic.persistence.annotationsobject{}PersistentVolumeClaim annotations
automatic.persistence.mountPathstring"/etc/openvpn"PersistentVolumeClaim mounting path
automatic.persistence.sizestring"8Gi"PersistentVolumeClaim size request
fullnameOverridestring""release full release name override option
image.pullPolicystring"IfNotPresent"container image pull policy
image.repositorystring"kylemanna/openvpn"container image repository
image.tagstring""container image tag or Chart appVersion if undefined
limitTraficToNamespacebooltruelimit network traffic just to OpenVPN namespace
limitedCidrstring"10.0.0.0/8"CIDR to be blocked out
nameOverridestring""release name override option
namespaceobject{"name":"ovpn"}release namespace
nodeSelectorobject{}node labels for pod assignment
resourcesobject{}pod resource requests & limits
service.portint31304OpenVPN port
service.protocolstring"TCP"OpenVPN protocol
service.typestring"NodePort"Service type
tolerationslist[]node taints to tolerate (requires Kubernetes >=1.6)

Acknowledgements

This chart is based on chepurko/k8s-ovpn which is using the great kylemanna/docker-openvpn Docker image.

Deploy personal-ovpn with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has personal-ovpn on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartpersonal-ovpn is pinned at v0.2.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply