kx yaml
Prints the raw YAML manifest for one or more indexed resources. --show fetches the same full manifest and narrows it client-side to the named top-level fields, so it works with anything kubectl’s own YAML output has.
kubectl’s own flags pass through. Naming an output format yourself replaces kx’s own -o yaml rather than arriving beside it, so kx yaml 1 -o json prints JSON. --show cannot be combined with one: it parses the YAML it narrows.
Several indexes are joined the way their format joins documents: YAML separated by ---, JSON merged into the one List kubectl answers several names with.
A flag kx doesn’t know is refused; put it after -- to pass it through to kubectl.
Usage
kx yaml [OPTIONS] <index>... [kubectl flags]Arguments
| Argument | Description |
|---|---|
<index>... | Row number from the current listing, or @name for a mark; kx state or kx mark shows them |
Options
| Option | Description |
|---|---|
--show string | Comma-separated fields to display (e.g. metadata,spec) |
Passthrough options
| Option | Description |
|---|---|
-A, --all-namespaces | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. |
--allow-missing-template-keys | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. |
--chunk-size int64 | Return large lists in chunks rather than all at once. Pass 0 to disable. |
--field-selector string | Selector (field query) to filter on, supports ‘=’, ‘==’, and ‘!=’.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. |
-f, --filename strings | Filename, directory, or URL to files identifying the resource to get from a server. |
--ignore-not-found | If set to true, suppresses NotFound error for specific objects that do not exist. Using this flag with commands that query for collections of resources has no effect when no resources are found. |
-k, --kustomize string | Process the kustomization directory. This flag can’t be used together with -f or -R. |
-L, --label-columns strings | Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2… |
--no-headers | When using the default or custom-column output format, don’t print headers (default print headers). |
-o, --output string | Output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns [https://kubernetes.io/docs/reference/kubectl/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/]. |
--output-watch-events | Output watch event objects when --watch or --watch-only is used. Existing objects are output as initial ADDED events. |
--raw string | Raw URI to request from the server. Uses the transport specified by the kubeconfig file. |
-R, --recursive | Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. |
-l, --selector string | Selector (label query) to filter on, supports ‘=’, ‘==’, ‘!=’, ‘in’, ’notin’.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints. |
--server-print | If true, have the server return the appropriate table output. Supports extension APIs and CRDs. |
--show-kind | If present, list the resource type for the requested object(s). |
--show-labels | When printing, show all labels as the last column (default hide labels column) |
--show-managed-fields | If true, keep the managedFields when printing objects in JSON or YAML format. |
--sort-by string | If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. ‘{.metadata.name}’). The field in the API resource specified by this JSONPath expression must be an integer or a string. |
--subresource string | If specified, gets the subresource of the requested object. |
--template string | Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
-w, --watch | After listing/getting the requested object, watch for changes. |
--watch-only | Watch for changes to the requested object(s), without listing/getting first. |
… | kubectl’s global flags too: --context, --kubeconfig, --as and the rest; kubectl options lists them |
Global options
| Option | Description |
|---|---|
--no-color | Disable styled output |
-h, --help | Show this message and exit |
Examples
kx yaml 1
kx yaml 1 2
kx yaml 1 --show metadata,spec
kx yaml 1..3
kx yaml 3..
kx yaml 1 --show-managed-fields