qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
8.03k stars 371 forks source link

Bug: /gluetun-entrypoint healthcheck exit with a 0 code even if gluetun is not ready #1190

Closed toniopelo closed 1 year ago

toniopelo commented 2 years ago

Is this urgent?

No response

Host OS

Using the docker image

CPU arch

No response

VPN service provider

Surfshark

What are you using to run the container

Kubernetes

What is the version of Gluetun

Running version latest built on 2022-10-02T09:36:14.095Z (commit cb80457)

What's the problem 🤔

I am using /gluetun-entrypoint healthcheck command to determine when my kubernetes pod container (running as a sidecar) is ready to receive connections via the http proxy. This command seem to exit with a 0 code even if gluetun is not ready.

Share your logs

$> kubectl exec my-pod-name -c gluetun -- sh -c "/gluetun-entrypoint healthcheck"; echo $?
2022-10-11T09:27:24Z ERROR HTTP response status is not OK: 500 500 Internal Server Error: healthcheck did not run yet

2022-10-11T09:27:24Z INFO Shutdown successful
0

Share your configuration

No response

diego95root commented 2 years ago

I was experiencing the same, had to play a bit with it to avoid this, it'd be great if it could be fixed. I ended up with the following:

docker exec -it proxy sh -c "GOOD='0';[[ $(./gluetun-entrypoint healthcheck | wc -c) -ne 0 ]] && GOOD='1';(exit $GOOD); echo $?"

Hope it helps!

qdm12 commented 1 year ago

(Sorry for lagging so much on issues)

I believe this has been fixed by https://github.com/qdm12/gluetun/commit/7a3b9941aaf6467f9b964456e25b34098b07f20d a few weeks ago. Let me know if it still not fixed. Thanks for reporting the issue too 👍

audiophonicz commented 6 months ago

I dont know if this issue has broken again, or wasnt fully fixed, but I am experiencing the same issue on the latest build.

./gluetun-entrypoint healthcheck returns 0 while v1/openvpn/status returns {"status":"stopped"}

gluetun image does not include curl and K8s cant parse the output of the status page so how to get the container to actually restart when the VPN fails?