Learn how to use VQL when querying Kubernetes Efficiency Reports in the API or using the Terraform Provider.
kubernetes
, which represents the available filters on Kubernetes Efficiency Reports in the Vantage console. To reference a filter, use the following syntax: namespace.field
(e.g., kubernetes.category
). The following fields are available within the kubernetes
namespace.
Namespace | Field | VQL Example |
---|---|---|
kubernetes | namespace | Namespace example |
kubernetes | cluster_id | Cluster ID example |
kubernetes | category | Category example |
kubernetes | labels | Labels example |
Keyword | Description | VQL Sample | Explanation |
---|---|---|---|
AND | Logical AND operator | (kubernetes.namespace = 'kube-system') AND (kubernetes.labels->>'app' = 'vantage-agent') | This example filters for a specific namespace and label, where both conditions must be true. |
OR | Logical OR operator | (kubernetes.namespace = 'gpu-operator') OR (kubernetes.namespace = 'vantage-dev') | This example looks for results in two different namespaces. At least one condition must be true. |
!= | Is not | (kubernetes.cluster_id != 'dev-eks-gpu-0') | This example looks for results that are in any cluster except for dev-eks-gpu-0 . |
IN and NOT IN | Used to compare against an array/list | (kubernetes.labels->>'app.kubernetes.io/component' IN ('csi-driver','gpu-operator','metrics')) | This example searches for results with the app.kubernetes.io/component key and multiple values. This same query also works for NOT IN where the results are anything matching the label key except for those particular values: (kubernetes.labels->>'app.kubernetes.io/component' NOT IN ('csi-driver','gpu-operator','metrics')) . |
LIKE and NOT LIKE | Performs string comparisons | (kubernetes.labels->>'app' LIKE '%test%') | This example selects data where the app label value contains test , such as test-app . This same query also works for NOT LIKE where data does not contain a particular string: (kubernetes.labels->>'app' NOT LIKE '%test%') . |
->> | This operator is used only when constructing queries related to labels | (kubernetes.labels->>'container' = 'kube-prometheus-stack-48.4.0') | This example looks results with the label name of container and value of kube-prometheus-stack-48.4.0 . |
cpu
.
app
, with the value rollouts-demo
.
OR
with multiple criteria.