Validate Kubernetes manifest files and kustomizations using kubeconform.
This command validates individual YAML files and kustomizations in the specified path.
If no path is provided, the path is resolved in order:
1. spec.workload.sourceDirectory from ksail.yaml (if a config file is found and the field is set)
2. The default source directory when spec.workload.sourceDirectory is unset ("k8s" directory)
3. The current directory (fallback when no ksail.yaml config file is found)
1. Validates individual YAML files (patch files referenced in a kustomization file via patches,
patchesStrategicMerge, or patchesJson6902 are excluded — they are not valid standalone
Kubernetes resources and are validated as part of the kustomize build output instead)
2. Validates kustomizations by building them with kustomize and validating the output
Checks follow the Flux Kustomizations the tree renders from its own flux-system source: the
folder each spec.path names is built the way Flux builds it (the Kustomization's composition merged
into the folder's kustomization, or a generated one, then its commonMetadata set on every applied
object), and that output is checked for schema and --rules. A composed folder is checked on its own
output too when another folder includes it. With --kyverno-policies, admission is evaluated as its
serviceAccountName (or the kustomize-controller), and an admission failure in a folder no
Kustomization applies, an ambiguous binding, a spec field validation does not reproduce and a path
outside the validated tree each fail with a named error.
Flux variable substitutions are resolved before validation using type-aware placeholders:
- ${VAR} (bare, no default): when a JSON schema type is available, substitutes a typed
placeholder derived from the schema for the field ("placeholder" for strings, 0 for
integers, true for booleans); when no schema type is available, it falls back to the
string value "placeholder"
- ${VAR:-default} / ${VAR:=default}: when a schema type is available, uses the default
value parsed according to the field schema type (e.g., "3" → int 3 for integer fields);
when no schema type is available, the default is parsed using YAML-native type inference
- Mixed text (e.g., "prefix.${VAR}"): substitutes "placeholder" in string context
Typed substitution reads remote schemas from the local cache and supplied local schemas
from disk, using the same schema locations and strictness as validation. Without a schema,
placeholders fall back to strings with YAML-native parsing.
Use --refresh-schemas to fetch selected schemas into a temporary cache before typing
placeholders. The persistent cache is updated only after the complete validation succeeds.
This requires access to remote schema locations; unavailable selected schemas fail even
when --ignore-missing-schemas is enabled. Kind exclusions still apply. Normal runs reuse
the persistent cache without automatic expiry. Registry locations are tried in order: an
unreachable earlier location can stop validation before a later cached schema is used.
Use --schema-location-mode only to select exactly the supplied/configured locations,
including derived CRD schemas, without implicit built-in or catalogue registries.
Offline use requires all selected schemas and remote references in the native cache,
or a complete local schema graph. This option does not prohibit network requests;
cache misses may still download and fail. Missing required schemas remain errors.
By default, Kubernetes Secrets are skipped to avoid validation failures due to SOPS fields.
ksail workload validate [PATH] [flags]
--ephemeral[=true|false] EXPERIMENTAL: run offline checks, then check workload admission in an isolated throwaway Kind cluster with declared Helm charts installed and ready (guaranteed teardown; off by default). Add --ephemeral-children to also validate observed descendants.
--ephemeral-children[=true|false] EXPERIMENTAL: validate an observed snapshot of owner-linked descendants of directly submitted workloads (requires --ephemeral; fails if none are observed; does not prove operator convergence)
--ephemeral-observation-wait duration Wait after admission before collecting children (positive, at most 5m; requires --ephemeral-children) (default 30s)
--ignore-missing-schemas[=true|false] Ignore resources with missing schemas (default true)
--include-crd-schemas[=true|false] Derive kubeconform schemas from CustomResourceDefinition manifests in the path so that custom resources whose CRD ships in the repo are validated instead of skipped (off by default; a CRD that cannot be converted is warned and skipped)
--kyverno-api-call-responses string Path, relative to the working directory, to a reviewed offline response fixture for Kyverno Kubernetes apiCall context entries. Exact method and URL-path matches only; missing responses fail closed and no live cluster or service access is enabled. Overrides spec.workload.validation.kyvernoApiCallResponses from ksail.yaml.
--kyverno-policies[=true|false] Evaluate the source's own Kyverno ClusterPolicy and Policy validate rules, and its CEL-based ValidatingPolicy and NamespacedValidatingPolicy validations, against the rendered manifests, as if each document were being created. On by default when ksail.yaml sets spec.cluster.policyEngine to Kyverno, off otherwise; --kyverno-policies=false turns it off. Each kustomization is evaluated against the policies in its own rendered output plus every cluster-scoped ClusterPolicy and ValidatingPolicy any other kustomization renders (its own copy of a same-named policy wins); a namespaced Policy or NamespacedValidatingPolicy applies only within the kustomization that renders it, loose YAML files are not evaluated, and other policies.kyverno.io kinds are not supported. When the tree renders Flux Kustomizations reading its own flux-system source, admission follows them: each one's spec.path (resolved against the Git top level for a GitRepository, otherwise against the source directory) is built the way Flux builds it (its targetNamespace, patches, images and components merged into the folder's kustomization, or into one Flux generates for a folder without one; a child Kustomization is read from its parent's composed output; its commonMetadata labels and annotations are then set on every object it applies), as its serviceAccountName in its own namespace or else as the kustomize-controller service account; a folder another folder includes is evaluated only through it unless a Flux Kustomization also applies it, in which case it is also evaluated with that binding's identity and composed output; a failure in a folder no Flux Kustomization applies is reported as unbound; and a path outside the validated tree, a missing path, or two Flux Kustomizations applying one folder differently, a spec field validation does not reproduce (such as kubeConfig), or bindings that never settle, each fail by name. Without them, every kustomization is evaluated as rendered with no requester identity, in the namespace each document declares (a policy that depends on the namespace of a namespaced document that declares none is reported as a warning). A ValidatingPolicy that calls the http library, or a CEL lookup of cluster, registry or global-context data, cannot be evaluated offline. A classic policy's Kubernetes apiCall context requires a reviewed --kyverno-api-call-responses fixture; the fixture never enables live cluster or service access, and a missing response fails closed. Namespace labels come from the kustomization's own Namespaces first, then from a Namespace another kustomization renders, unless two render it with different labels. For an unrendered Namespace, selectors are evaluated only when Kubernetes' immutable kubernetes.io/metadata.name label determines the result; other labels remain unknown. Repeated unknown-namespace warnings are grouped by policy, rule, namespace and reason, with evaluation, resource and source counts and a representative example. A rule a cluster would enforce fails validation; an audit-only failure or a rule that cannot be evaluated offline is reported as a warning.
--refresh-schemas[=true|false] Download selected schemas anew and update the cache only after validation succeeds; unavailable selected schemas fail even when missing schemas are normally ignored
--rules string Path to a YAML CEL rules file. Each rule's CEL expression is evaluated against every rendered document (bound to the 'object' variable); an error-severity violation fails validation, a warning-severity violation is reported without failing. Overrides spec.workload.validation.rules from ksail.yaml.
--schema-location strings Supplied kubeconform schema locations (local directory or URL/path template), after built-ins by default or exclusively with --schema-location-mode only (merged with spec.workload.validation.schemaLocations from ksail.yaml)
--schema-location-mode string Schema search mode: additional keeps built-in and catalogue defaults; only uses the supplied schema locations without implicit registries (default "additional")
--skip-helm-render[=true|false] Skip rendering HelmReleases before validation (validate the HelmRelease CR as-is). By default, charts are rendered in-process and the rendered manifests are validated.
--skip-kinds strings Additional Kubernetes kinds to skip during validation (merged with spec.workload.validation.skipKinds from ksail.yaml)
--skip-secrets[=true|false] Skip validation of Kubernetes Secrets (default true)
--strict[=true|false] Enable strict validation mode
--benchmark[=true|false] Show per-activity benchmark output
--config string Path to config file (default: ksail.yaml found via directory traversal)
--experimental[=true|false] Enable experimental (unstable) commands and features