具体来说,我正在尝试创建一个合适的 Kubernetes 就绪探测(因此需要运行一个命令或命中一个就绪端点,它将发出 OpenVPN 是否已启动并准备就绪的信号)。
答案1
来自官方 OpenVPN 文档:
Sun Feb 6 20:46:38 2005 OpenVPN 2.0_rc12 i686-suse-linux [SSL] [LZO] [EPOLL] built on Feb 5 2005
Sun Feb 6 20:46:38 2005 Diffie-Hellman initialized with 1024 bit key
Sun Feb 6 20:46:38 2005 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Sun Feb 6 20:46:38 2005 TUN/TAP device tun1 opened
Sun Feb 6 20:46:38 2005 /sbin/ifconfig tun1 10.8.0.1 pointopoint 10.8.0.2 mtu 1500
Sun Feb 6 20:46:38 2005 /sbin/route add -net 10.8.0.0 netmask 255.255.255.0 gw 10.8.0.2
Sun Feb 6 20:46:38 2005 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:23 ET:0 EL:0 AF:3/1 ]
Sun Feb 6 20:46:38 2005 UDPv4 link local (bound): [undef]:1194
Sun Feb 6 20:46:38 2005 UDPv4 link remote: [undef]
Sun Feb 6 20:46:38 2005 MULTI: multi_init called, r=256 v=256
Sun Feb 6 20:46:38 2005 IFCONFIG POOL: base=10.8.0.4 size=62
Sun Feb 6 20:46:38 2005 IFCONFIG POOL LIST
Sun Feb 6 20:46:38 2005 Initialization Sequence Completed
https://community.openvpn.net/openvpn/wiki/HOWTO#Startingtheserver
因此这Initialization Sequence Completed
可能是一个很好的指标,表明服务器已经完成初始化。
答案2
抱歉,这个问题的措辞有点奇怪,但我发现可行的解决方案是使用 netcat:如果处于 TCP 模式,则nc -uz 127.0.0.1 443
删除标志:-u
https://github.com/helm/charts/pull/15580/files