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

Filters and Kubernetes Annotations visibility


Trying to set up a filter using an annotation value for worker nodes in a K8S cluster .. the node currently has 

$ kubectl get node ag1-sres-workload-01-md-0-85585fc84d-4q6h4 -o yaml
apiVersion: v1
kind: Node
  annotations: xxx-xxx-xxx default xxx-xxx-xxx-md-0-85585fc84d-4q6h4 MachineSet xxx-xxx-xxx-md-0-85585fc84d '{"":"xxx-xxx-xxx-md-0-85585fc84d-4q6h4"}' /var/run/containerd/containerd.sock "0" "true"
  creationTimestamp: "2023-07-13T08:37:59Z"
  labels: amd64 linux amd64 xxx-xxx-xxx-md-0-85585fc84d-4q6h4 linux vsphere-vm.cpu-16.mem-64gb.os-photon
  name: ag1-sres-workload-01-md-0-85585fc84d-4q6h4
  resourceVersion: "51487447"
  uid: d6528bff-d96f-439e-8384-42a826066119

 When I am in Data Explorer and get to Kubernetes nodes:Kubernetes labels I only see the labels and not the annotations. I'd like to be able to filter on the annotation MachineSet which I thought would appear as a label. How do I filter on the annotation ? 



You can use kubectl with the -o jsonpath option to filter resources based on annotations. For example, to get all nodes with the annotation MachineSet, you can use the following command:

kubectl get nodes -o jsonpath='{.items[?(@.metadata.annotations.cluster\.x-k8s\.io/owner-kind=="MachineSet")]}'

This command uses a jsonpath expression to filter the nodes based on the value of the annotation.

Dynatrace Certified

Sorry, to clarify, I'm trying to filter in Data Explorer 

Featured Posts