cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the cloud provider name from Kubertenes

AurelienGravier
DynaMight Champion
DynaMight Champion

Hello,

The only way I've found to determine whether a cluster is running on AKS or EKS is to use a classicEntitySelector like this:

fetch dt.entity.cloud_application_namespace
| filter in (id, classicEntitySelector("""type(CLOUD_APPLICATION_NAMESPACE),toRelationships.isClusterOfNamespace(type(KUBERNETES_CLUSTER),fromRelationships.isClusterOfNode(type(KUBERNETES_NODE),kubernetesProviderType("PROVIDER_TYPE_EKS")))"""))
| fieldsAdd CLOUD_PROVIDER = "AWS"
| append [
fetch dt.entity.cloud_application_namespace
| filter in (id, classicEntitySelector("""type(CLOUD_APPLICATION_NAMESPACE),toRelationships.isClusterOfNamespace(type(KUBERNETES_CLUSTER),fromRelationships.isClusterOfNode(type(KUBERNETES_NODE),kubernetesProviderType("PROVIDER_TYPE_AKS")))"""))
| fieldsAdd CLOUD_PROVIDER = "AZURE"]

 

It's quite limiting, because I can only use the classicEntitySelector through a filter.

As a result, I have to repeat the command through multiple appends, and I'm unable to handle cloud providers that aren't explicitly declared.

Do you have another idea for collecting this information?

Thanks. Aurélien.

Observability consultant - Dynatrace Associate/Pro/Services certified
2 REPLIES 2

amine_bergi
Dynatrace Participant
Dynatrace Participant

Hello Aurélien, 
The property kubernetesProviderType is already present in the node entity, so you can use it without using the  classicEntitySelector. 
Here's the dql statement that you could use for instance: 

fetch  dt.entity.cloud_application_namespace
| fields namespace_name=entity.name,clustered_by[dt.entity.kubernetes_cluster]
| join [ fetch dt.entity.kubernetes_node | fields clustered_by[dt.entity.kubernetes_cluster] , kubernetesProviderType], on:{`clustered_by[dt.entity.kubernetes_cluster]`}
| fieldsAdd  cluster=entityName(`clustered_by[dt.entity.kubernetes_cluster]`,type:"dt.entity.kubernetes_cluster"),provider_type=right.kubernetesProviderType
|fieldskeep cluster, namespace_name,provider_type

Amine  

AurelienGravier
DynaMight Champion
DynaMight Champion

Hello @amine_bergi 
Perfect, thank you for your help.
Regards

Observability consultant - Dynatrace Associate/Pro/Services certified

Featured Posts