Setting a port on the PodSpec results in a HTTP server crash
luxas opened this issue · comments
Lucas Käldström commented
{"level":"fatal","ts":"2019-03-21T17:48:59.820Z","caller":"api/server.go:127","msg":"HTTP server crashed","error":"listen tcp: address :tcp://10.111.55.252:9898: too many colons in address","stacktrace":"github.com/stefanprodan/k8s-podinfo/pkg/api.(*Server).ListenAndServe.func1\n\t/go/src/github.com/stefanprodan/k8s-podinfo/pkg/api/server.go:127"}
Lucas Käldström commented
Seems like the HTTP server's Config object's Port field somehow became tcp://10.111.55.252:9898
due to some viper auto-detection from env variables created by k8s?
ref: https://github.com/stefanprodan/k8s-podinfo/blob/master/pkg/api/server.go#L104
Stefan Prodan commented
Ah.. the Kubernetes ENV is prefixing the vars with PODINFO
probably...
Lucas Käldström commented
Yep, PODINFO_PORT=tcp://10.100.7.158:9898
is present in a k8s-run container with a Pod port set
Stefan Prodan commented
Do you have the --port=9898
arg in pod spec?
Lucas Käldström commented
yes
Stefan Prodan commented
Use this:
image: quay.io/stefanprodan/podinfo:1.4.0
command:
- ./podinfo
- --port=9898
The arg should overwrite the env var.
Lucas Käldström commented
Yeah, but can we detect it after viper's auto-detection so that e.g. kubectl run
-demos work?
Stefan Prodan commented
@luxas it should work now with version 1.4.3