diff --git a/extra/healthcheck.go b/extra/healthcheck.go index 302883d84..f79b3e65b 100644 --- a/extra/healthcheck.go +++ b/extra/healthcheck.go @@ -11,12 +11,17 @@ import ( "net/http" "os" "runtime" + "strings" "time" ) func main() { isFreeBSD := runtime.GOOS == "freebsd" + // Is K8S + uptime-kuma as the container name + // See #2083 + isK8s := strings.HasPrefix(os.Getenv("UPTIME_KUMA_PORT"), "tcp://") + // process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ InsecureSkipVerify: true, @@ -44,7 +49,11 @@ func main() { hostname = "127.0.0.1" } - port := os.Getenv("UPTIME_KUMA_PORT") + port := "" + // UPTIME_KUMA_PORT is override by K8S unexpectedly, + if !isK8s { + port = os.Getenv("UPTIME_KUMA_PORT") + } if len(port) == 0 { port = os.Getenv("PORT") }