Detect infrastructure provider in a custom controller

10/15/2019

Is there a way to detect infrastructure provider (e.g., GKE, AKS, On-Prem) in a Kubernetes custom controller? I need to check and configure things differently as different environments have different constraints.

-- Dagang
kubernetes

1 Answer

10/18/2019

Recently I have been also interested in the same task. So far, I've deserved K8s provider detection through catching particular ProviderID field, promoted by a specific cloud provider's Controller Manager, on each k8s target node.

kubectl get no | awk '{print $1}'| sed '1d'| while read -r node; do echo "$node=$(kubectl get no $node -o jsonpath='{.spec.providerID}')"; done

Sharing your experience and further progress with more efficient solution will be highly appreciated.

Hope that this can be useful also for any other community contributors research.

-- mk_sta
Source: StackOverflow