kubernetesgoogle-kubernetes-engineamazon-eksazure-aks

How can I detect which hyperscaler is running my Kubernetes cluster?


I have to configure an application running on Kubernetes, and I do not have access to any hyperscaler-specific management infrastructure.

How can I figure out whether my cluster runs on one of the big three (Amazon, Azure, or Google GKE) using only kubectl with a valid KUBECONFIG file?


Solution

  • I found a technical solution: the node.spec.providerID field starts with the platform name.

    kubectl get nodes -o jsonpath='{.items[].spec.providerID}'
    

    returns <ProviderName>://<ProviderSpecificNodeID>.

    See the definition of Node in the Kubernetes Specs.