大网数据广告活动
服务器运维问答

Running OpenVPN within k8s container

· 52CE 我爱测

Suppose I have a k8s cluster whose services IP range is 10.198.240.0/20 . Now I want this IP range to be accessible from another cluster or data center. Is it feasible to run OpenVPN within kubernetes POD so that this IP range is…

问题原文

原帖链接 · Mr.Wang from Next Door · CC BY-SA 3.0

Suppose I have a k8s cluster whose services IP range is 10.198.240.0/20.

Now I want this IP range to be accessible from another cluster or data center.

Is it feasible to run OpenVPN within kubernetes POD so that this IP range is accessible via VPN?

已采纳解答

原帖链接 · pieter · CC BY-SA 4.0

Had the same problem and made this solution:

Try it and let me know if it works for you.

Instructions:

docker run --user=$(id -u) -e OVPN_SERVER_URL=tcp://vpn.my.fqdn:1194 \
-v $PWD:/etc/openvpn:z -ti ptlange/openvpn ovpn_initpki
docker run --user=$(id -u) -e EASYRSA_CRL_DAYS=180 \
-v $PWD:/etc/openvpn:z -ti ptlange/openvpn easyrsa gen-crl

get the service ID

$ ./kube/deploy.sh
Usage: ./kube/deploy.sh <namespace> <OpenVPN URL> <service cidr> <pod cidr>

$ ./kube/deploy.sh default tcp://vpn.my.fqdn:1194 10.3.0.0/24 10.2.0.0/16
secret "openvpn-pki" created
configmap "openvpn-settings" created
configmap "openvpn-ccd" created
deployment "openvpn" created
You have exposed your service on an external port on all nodes in your
cluster.  If you want to expose this service to the external internet, you may
need to set up firewall rules for the service port(s) (tcp:30xxx) to serve traffic.

See http://releases.k8s.io/release-1.3/docs/user-guide/services-firewalls.md for
more details. service "openvpn-ingress" created

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。