glab(1)
π¦ glab cluster graph π
okay so this is a page straight out of the glab(1) manual, and bestie, it's a whole vibe. it's about poking at your Kubernetes object graph through the GitLab Agent, and yeah β it's EXPERIMENTAL, we'll get to that.
πΈ NAME πΈ
glab-cluster-graph β query the Kubernetes object graph using the GitLab Agent for Kubernetes. (EXPERIMENTAL) π§ͺ
β¨ SYNOPSIS β¨
glab cluster graph [flags]
π DESCRIPTION π
So this command literally spins up a web server that shows you a live view of the Kubernetes object graph in your browser. slay. it pulls all of that through the GitLab Agent for Kubernetes that's already running in the cluster.
here's the checklist, no cap β it requires:
- Version 18.1 or later of GitLab and the GitLab Agent.
- At least the Developer role in the agent project.
- A personal access token or project access token for authentication. the token must have the
read_apiandk8s_proxyscopes. both of them. don't skip one π
got feedback? drop it in [issue 7900](https://gitlab.com/gitlab-org/cli/-/issues/7900) β they say "Leave feedback in issue 7900 β¨https://gitlab.com/gitlab-org/cli/-/issues/7900β©" and honestly yes, go tell them.
π Resource filtering π
To filter resources, namespaces, and select root objects, you use Common Expression Language (CEL) β¨https://cel.dev/β©. it's giving query-language main character energy.
object_selector_expression β filters objects. the expression must return a boolean. these are the variables you get to play with:
objβ the Kubernetes object being evaluated.groupβ the group of the object.versionβ the version of the object.resourceβ the resource name of the object, likepodsfor the Pod kind.namespaceβ the namespace of the object.nameβ the name of the object.labelsβ the labels of the object.annotationsβ the annotations of the object.
resource_selector_expression β filters Kubernetes discovery information to include or exclude resources from the watch request. must also return a boolean. variables:
groupβ the group of the object.versionβ the version of the object.resourceβ the resource name of the object, likepodsfor the Pod kind.namespacedβ the scope ofgroup,version, andresource. can bebool,true, orfalse.
To select root objects, use the --root-expression flag. when it's set, only objects that are directly or transitively reachable from root objects are shown. it uses the same variables as object_selector_expression, and it must return a boolean. multiple values are joined with OR statements β if any match, that object is used as root. π«
want more on using label selectors β¨https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectorsβ© and field selectors β¨https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/β© to select namespaces? the Kubernetes documentation has you covered.
π§ Advanced usage π§
Besides the high-level ways to construct the query, this command also lets you construct and send the query using all the underlying API features. iconique. to understand what's possible and how to do it, see the technical design doc β¨https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/blob/master/doc/graph_api.mdβ©.
the user should have permission to access the agent project. for more info, see Grant users Kubernetes access β¨https://docs.gitlab.com/user/clusters/agent/user_access/β©.
β οΈ bestie, listen: this feature is an experiment and is not ready for production use. it might be unstable or removed at any time. like, at any time. for more information, see https://docs.gitlab.com/policy/development_stages_support/.
π₯ OPTIONS π₯
-a,--agent=0β the numeric agent ID to connect to.--apps[=false]β watchdeployments,replicasets,daemonsets, andstatefulsetsin theapps/v1group.--batch[=false]β watchjobsandcronjobsin thebatch/v1group.--cluster-rbac[=false]β watchclusterrolesandclusterrolebindingsin therbac.authorization.k8s.io/v1group.--core[=false]β watchpods,secrets,configmaps, andserviceaccountsin thecore/v1group.--crd[=false]β watchcustomresourcedefinitionsin theapiextensions.k8s.io/v1group.--ignore-arc-direction[=false]β ignore arc direction when evaluating root connectivity. requires GitLab and agent version 18.3 or later.--listen-addr="localhost:0"β address to listen on.--listen-net="tcp"β network on which to listen for connections.--log-watch-request[=false]β log watch request to stdout. helpful for debugging. π-n,--namespace=[]β namespaces to watch. if not specified, all namespaces are watched with label and field selectors filtering.--ns-expression=""β CEL expression to select namespaces. evaluated before a namespace is watched and on any updates for the namespace object.--ns-field-selector=""β field selector to select namespaces.--ns-label-selector=""β label selector to select namespaces.--rbac[=false]β watchrolesandrolebindingsin therbac.authorization.k8s.io/v1group.-r,--resource=[]β resources to watch. you can see the list of resources your cluster supports by running'kubectl api-resources'.--root-expression=[]β CEL expression to select root objects. requires GitLab and agent version 18.3 or later.--stdin[=false]β read watch request from standard input.
π OPTIONS INHERITED FROM PARENT COMMANDS π
-h,--help[=false]β show help for this command.-R,--repo=""β select another repository. you can use eitherOWNER/REPOorGROUP/NAMESPACE/REPO. the full URL or Git URL is also accepted. flexible queen π
π EXAMPLE π
# Run the default query for agent 123
glab cluster graph -R user/project -a 123
# Show common resources from the core and RBAC groups
glab cluster graph -R user/project -a 123 --core --rbac
# Show certain resources
glab cluster graph -R user/project -a 123 --resource=pods --resource=configmaps
# Same as above, but more compact
glab cluster graph -R user/project -a 123 -r={pods,configmaps}
# Select a certain namespace
glab cluster graph -R user/project -a 123 -n={my-ns,my-stuff}
# Select namespaces with a certain label
glab cluster graph -R user/project -a 123 --ns-label-selector environment=production
# Pass a custom watch request from a file
glab cluster graph -R user/project -a 123 --stdin < query.json
# Show objects reachable from pod roots
glab cluster graph -R user/project -a 123 --root-expression "resource == \"pods\""
β SEE ALSO β
glab-cluster(1)π«Ά
and that's the whole page, bestie β¨ this lil' beauty was auto generated by spf13/cobra, dated Nov 2026, and it lives in the glab(1) manual β mwah, go query that graph ππ
π¦ where this page comes from
- arch rolling: glab 1.128.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms