Skip to content

kx secret

Lists Secrets exactly as kx get does. With --decode, prints an indexed Secret’s data in plaintext, or every Secret in the namespace when no index is given.

A --sort sorts the table kx draws by its own columns, before numbering it, so row 1 is the first sorted row: name the columns separated by commas, as the header reads them, with a leading - to sort one from largest down. A Secret listing’s columns are NAME, TYPE, DATA and AGE, which sort as what they hold — DATA as a count, AGE as a duration — and ties keep kubectl’s order. With --decode there is no listing to sort, only one Secret’s data, so the two cannot be combined. kubectl’s own --sort-by still takes a JSONPath, and applies first.

A --limit keeps the first N rows, after --match narrows them and --sort orders them and before they are numbered, so --sort age --limit 5 is the five newest numbered 1 to 5, and an index past them names nothing. The caption counts the rows kept against the rows there were.

A flag kx doesn’t know is refused; put it after -- to pass it through to kubectl.

Usage

kx secret [OPTIONS] [index]... [kubectl flags]

Aliases

kx secrets

Arguments

ArgumentDescription
[index]...Row number from the current listing, or @name for a mark; kx state or kx mark shows them

Options

OptionDescription
-A, --all-namespacesList across every namespace; each row is indexed and carries its own namespace
--decodeShow Secret data in plaintext; every Secret in the namespace when no index is given
-k, --key stringWith --decode, print only this key’s value
--limit intKeep the first N rows, after --match and --sort and before indexing
-m, --match stringMatch by name (substring, case-insensitive)
-n, --namespace stringNamespace to list from; defaults to the current namespace
--no-headersLeave out the header row; kx can’t number a table without one
-o, --output stringOutput format, as kubectl takes it; kx numbers only a table
--sort stringSort by the columns shown, before indexing: ’type,-age’ sorts by TYPE, then by AGE from oldest to newest
-w, --watchRedraw the listing live as resources change; on a terminal, each row is numbered as it appears
-y, --yesSkip the confirmation prompt for a namespace-wide --decode

Passthrough options

OptionDescription
--allow-missing-template-keysIf 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 int64Return large lists in chunks rather than all at once. Pass 0 to disable.
--field-selector stringSelector (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 stringsFilename, directory, or URL to files identifying the resource to get from a server.
--ignore-not-foundIf 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.
--kustomize stringProcess the kustomization directory. This flag can’t be used together with -f or -R.
-L, --label-columns stringsAccepts 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…
--output-watch-eventsOutput watch event objects when --watch or --watch-only is used. Existing objects are output as initial ADDED events.
--raw stringRaw URI to request from the server. Uses the transport specified by the kubeconfig file.
-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
-l, --selector stringSelector (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-printIf true, have the server return the appropriate table output. Supports extension APIs and CRDs.
--show-kindIf present, list the resource type for the requested object(s).
--show-labelsWhen printing, show all labels as the last column (default hide labels column)
--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.
--sort-by stringIf 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 stringIf specified, gets the subresource of the requested object.
--template stringTemplate 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].
--watch-onlyWatch 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

OptionDescription
--no-colorDisable styled output
-h, --helpShow this message and exit

Examples

kx secret
kx secret 1 --decode
kx secret 1 --decode -k tls.crt
kx secret 1..3
kx secret 3..
kx secret -l app=web
kx secret --sort type,-age
kx secret --sort -age --limit 3