Closed
Description
In Spring Cloud Data Flow we would like to detect when an application is running in Kuberenetes.
One approach maybe to check for an environment variable such as KUBERNETES_SERVICE_HOST
since k8s sets a property of this form - see https://github.com/kubernetes/kubernetes/blob/v1.11.0/pkg/kubelet/envvars/envvars.go#L45 .
I haven't yet seen a (service.Name) value different than KUBERNETES but I guess it is possible.
provides a isInsideKubernetes
method but it requires a KubernetesClient
to be created and I actually don't think it isn't answering the question if the code is running inside of a kubernetes pod.
Given that Kubernetes is quite a popular platform adding some support for detecting this would be useful.