allow the target to be set to http://kubernetes_host_ip:30556#19
allow the target to be set to http://kubernetes_host_ip:30556#19mpnally wants to merge 2 commits into
Conversation
|
I added code to access the K8S management API within the cluster to retrieve the hostIP address for the node on which the pod is running. Before going down this path, I tried 2 other approaches and struck out with each. One was to try to use the feature referenced in this pull request that Jeremy pointed out: kubernetes/kubernetes#27880. Unfortunately, this gives you the host name, not its IP address. Also, it is the hosts external name, as it is known outside the cluster. It is not resolvable within the cluster (its not in DNS, at least) I also tried Jeremy's suggestion of parsing /proc/net/route. On the machines I looked at, there is nothing useful in that file. I spent some time rummaging around in other files and did not find anything helpful |
| var token = fs.readFileSync('/var/run/secrets/kubernetes.io/serviceaccount/token').toString() | ||
| var cert = fs.readFileSync('/var/run/secrets/kubernetes.io/serviceaccount/ca.crt').toString() | ||
| var ns = fs.readFileSync('/var/run/secrets/kubernetes.io/serviceaccount/namespace').toString() | ||
| var podName = process.env.POD_NAME |
There was a problem hiding this comment.
This is quite the assumption here. We should document how to use this and/or make this a configuration item that can be set in the YAML itself and overridden via an environment variable. Also, we do not do any sort of validation on the value and just assume its set. We should handle this.
No description provided.