假设我有一个 k8s 集群,其服务 IP 范围是10.198.240.0/20。
现在我希望可以从另一个集群或数据中心访问该 IP 范围。
在 kubernetes POD 内运行 OpenVPN 是否可行,以便可以通过 VPN 访问该 IP 范围?
答案1
遇到了同样的问题,并此解决方案:
尝试一下并告诉我它是否对你有用。
指示:
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
获取服务 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