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

Which API?: kubernetes > get list of project ID, project name, namespace, PODs

avrildong
Helper

Use case & Goal: 

Applicable to both "GCP > GKE" and "Openshift". We intend to retrieve list of project ID (gce project id if apply), project name(gce project name if apply), namespace, PODs, cluster name, process group name ( if present).

 

Question: which API we can use to grab above?  namespace is must-have info.  

2 REPLIES 2

Mizső
DynaMight Leader
DynaMight Leader

Hi @avrildong,

 

Maybe there is a more simple way but I would use the from the Enviroment Api v2 Monitored entities set.

 

I have just created a auto tag for Kubernetes entities.

 

Mizs_0-1668505447378.png

Then I have used thre Get / entities Api with with the Entity Selector Type("Process_Group_Instance"),Tag("Kubernetes"). So I have already received the a list of kubernetes process group list.

Mizs_2-1668505691137.png

 

From the list I have picked up a process group instance and checked it with the following Api call: GET / entities/({entityId}:

 

Mizs_3-1668505845558.png

 

I have already received the properties:

Mizs_4-1668505963722.png

 

Try and play with these Monitored entities API calls.

 

I hope it helps. 

 

Best regards,

 

Mizső

 

 

 

 

 

 

 

 

Dynatrace Community RockStar 2024, Certified Dynatrace Professional

@Mizső

Thanks for your approach! It works.

FYI one more approach I just got from other parties and it works too, similar principle as yours using same identifier "kubernetesNamespaces".

api/v1/entity/infrastructure/processes > identify via "kubernetesNamespaces" , no need to custom tag (save one step), just straight use that.

So as of now 2 API - either:

  • api/v2/entities?entitySelector=Type("Process_Group_Instance")&fields=firstSeenTms,lastSeenTms,properties,tags,managementZones , then filter by "properties"."metadata"."key" start with "KUBERNETES_%"
  • api/v1/entity/infrastructure/processes

Featured Posts