Skip to content

cub k8s get

cub k8s get

List and describe Kubernetes resources stored in ConfigHub

Synopsis

List Kubernetes resources held in ConfigHub Units, describe them, or print their YAML.

Resources are named the way kubectl names them: a plural ("deployments"), a singular ("deployment"), a short name ("deploy"), a Kind ("Deployment"), a qualified name ("deployments.apps"), or a full ConfigHub resource type ("apps/v1/Deployment"). Types not built in still resolve by Kind across any API group, so custom resources work too. Several types may be given at once, comma-separated.

The pseudo-type "all" means every resource type except CustomResourceDefinition, whose schemas would swamp everything else. Ask for "crd" explicitly to see those.

This shows configuration, not live cluster state: everything comes from the configuration data in ConfigHub, along with the Space, Unit, and Target it belongs to.

Three views, selected with --show:

list (default) one row per resource detail a described summary of each resource, like "kubectl describe" data the resource's YAML as stored

Examples:

  # Deployments in a space
  cub k8s get deploy --space my-space

  # NetworkPolicies across everything applied to a target
  cub k8s get netpol --target prod-use2/prod-use2-oci

  # Two types at once, across all spaces
  cub k8s get deploy,sts --space "*"

  # Describe one resource by name
  cub k8s get deploy my-app --space my-space --show detail

  # Print the YAML of every ConfigMap in a namespace
  cub k8s get cm -n kube-system --space "*" --show data

  # Everything except CRDs in one unit
  cub k8s get all --space my-space --where "Unit.Slug = 'my-unit'"

  # Everything in the production spaces whose unit name ends in -backend
  cub k8s get all --space "*" --where "Unit.Slug LIKE '%-backend' AND Space.Labels.Environment = 'prod'"

  # Deployments with more than one replica
  cub k8s get deploy --space "*" --where-resource "spec.replicas > 1"

  # Custom resources by Kind
  cub k8s get externalsecrets --space "*"

  # Machine-readable output
  cub k8s get svc --space "*" -o json
  cub k8s get svc --space "*" -o name

Filtering combines four independent scopes, all ANDed:

--space / --target where the resources live / / --namespace which resources --where any condition on the resource or the entities containing it, with a prefix: Unit.Slug, Unit.Labels.App, Space.Labels.Environment, Target.Slug --where-resource a condition on the resource's configuration, e.g. "spec.replicas > 1"

Both --where and --where-resource are evaluated by the server against the stored resources, so a fleet-wide sweep does not read every unit's configuration.

cub k8s get <type>[,<type>...] [<name> ...] [flags]

Options

      --filter string           Filter entity to apply to the list. Specify as 'space/filter' for cross-space filters or just 'filter' for current space. Supports both slugs and UUIDs. The filter will be combined with any --where clause using AND logic. Examples: "production-filters/security-check", "my-filter-uuid", "validation-rules"
  -h, --help                    help for get
  -n, --namespace string        only resources in this Kubernetes namespace
      --no-headers              Don't print headers for table output
  -o, --output string           Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
      --quiet                   No default output.
      --show string             how much of each resource to show. One of: list, detail, data (default "list")
      --space string            space ID to perform command on
      --target strings          only Units bound to these targets, as space-slug/target-slug (can be repeated or comma-separated); implies --space '*' unless --space is given
      --verbose                 Detailed output, additive with default output
      --where string            Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, NOT LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"
      --where-resource string   additional filter on individual resources, ANDed with the resource type; e.g. "spec.replicas > 1"

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output

SEE ALSO