docs/config-output.md
Kubescape can now render cached configuration values in multiple output formats so operators can inspect the active configuration in the format that best fits their workflow.
The configuration view command previously printed the cached JSON payload directly. That worked for machine-oriented use cases, but it was harder to inspect interactively when you wanted a quick summary or a YAML-friendly representation.
The new output support adds:
The command accepts the following values with the --output flag:
text (default): a compact, human-readable block of key: value entriesjson: a JSON object with the current config fieldsyaml: a YAML mapping with the current config fieldskubescape config view
Example output:
accountID: 1234567890
cloudAPIURL: https://api.example.com
cloudReportURL: https://report.example.com
kubescape config view -o json
Example output:
{
"accountID": "1234567890",
"cloudAPIURL": "https://api.example.com",
"cloudReportURL": "https://report.example.com"
}
kubescape config view -o yaml
Example output:
accountID: 1234567890
cloudAPIURL: https://api.example.com
cloudReportURL: https://report.example.com
If you want the output to preserve the full field structure, including empty values, use the --include-empty flag.
kubescape config view -o json --include-empty
Example output:
{
"accessKey": "",
"accountID": "1234567890",
"clusterName": "",
"cloudAPIURL": "https://api.example.com",
"cloudReportURL": "https://report.example.com"
}
kubescape config view [--format text|json|yaml] [--include-empty]
-f, --format: select the rendering format (text, json, yaml)-o, --output: alias for --format-e, --include-empty: include empty values in the rendered payloadThis output formatting is helpful when you want to:
The rendered fields use stable lower camel case names:
accountIDclusterNamecloudReportURLcloudAPIURLaccessKeyaccessKey is a credential, so it is rendered masked in every format: only its
last four characters are shown, prefixed with **** (a key of eight characters
or fewer is masked in full). The command is meant for CI logs and shared
terminals, so it never prints the key itself; read the cached configuration file
directly if you need the full value.
By default, fields with empty values are not rendered. This keeps terminal output short and avoids noisy structured payloads in scripts that only need configured values.
When --include-empty is set, every supported field is rendered even if its
value is empty. This is useful for tools that validate the expected shape of
the cached configuration.
The text format renders one key: value pair per line. It is designed for
operators reading logs or terminals, not for strict machine parsing.
The json format renders a JSON object. Scripts can read the fields with tools
such as jq without depending on the text layout.
The yaml format renders a YAML mapping. This is convenient when comparing the
cached values with Kubernetes manifests, Helm values, or other YAML-oriented
configuration files.
Unknown output formats return an error instead of falling back to text. This helps automation fail early when a flag value is misspelled.
The command only reads and renders the cached configuration. It does not create, update, delete, or normalize the saved configuration file.
For scripts, prefer -o json and check for missing keys explicitly.
For reviews, prefer -o yaml --include-empty so unset fields are visible.
For logs, prefer the default text format because it is compact.
Do not treat omitted fields as deleted configuration values.
Quote shell variables that may contain URLs or access keys.
When an account ID appears to be missing, you can render the config in a structured format and compare the values across environments.
kubescape config view -o yaml
You can use JSON output to build scripts that validate that required configuration keys are present before a scan starts.
kubescape config view -o json | jq '.accountID'
The text output is ideal for quick human inspection in CI logs or local development shells.
kubescape config view
--include-empty is specified.A common workflow looks like this:
kubescape config view -o json
kubescape config set accountID <your-account-id>
kubescape config view -o yaml
This sequence lets you verify the current configuration, update it, and then render the result in a structure that is easier to reason about.
The enhanced configuration view output gives you more flexibility without changing the underlying cached configuration model. Whether you prefer a terminal-friendly text layout or structured JSON or YAML, the command now supports your preferred workflow.