Skip to content

YAML editor

yuriy edited this page Oct 19, 2026 · 1 revision

YAML editor

When you edit an object or create resources from YAML, the editor knows the fields of each kind from the cluster itself: it completes field names and allowed values, underlines what the cluster would not accept, shows a field's documentation when you point at it, and opens an Explain panel like kubectl explain. It works for built-in kinds and for custom resources, at the versions your cluster serves.

Contents: Where it works · Completion · Problems · Documentation and Explain · Where the schema comes from · Without a schema · Keyboard

Where it works

  • Edit (details panel or row menu): the object's YAML in a dock tab.
  • Create resource (+ in the dock's bar): YAML you paste or type, also several documents separated by ---. Each document is checked against the schema of its own apiVersion and kind.

Helm's Edit values and the editors of extensions do not use the schema: their text is not a Kubernetes object.

Completion

Start typing a key, or press Ctrl+Space:

  • Fields of the object at the cursor: required ones first, fields already written left out, each with its type and the first line of its description.
  • Values: the allowed values of a field that has a fixed list (for example imagePullPolicy, restartPolicy, a Service's type), and true/false for booleans.

The path at the cursor is worked out from the indentation, so completion works while the text is still half written: in block maps and lists, after ---, around block scalars (|, >), and in flow style ({…}, […]) on the cursor's line.

Problems

A short while after you stop typing, the editor underlines:

Problem Example
Unknown field spec.replica instead of spec.replicas
Wrong type replicas: "3" where a number is expected
Missing required field a container without name
Value not allowed imagePullPolicy: Sometimes
YAML error bad indentation, a tab, an unclosed quote

Fields whose schema accepts anything (for example a ConfigMap's data keys, x-kubernetes-preserve-unknown-fields, embedded objects) are not reported as unknown. The status of an object is not checked.

The problems are advice: they never block Save or Apply. The API server's answer decides, and Preview changes shows what it would store, with its own validation and admission webhooks.

Documentation and Explain

  • Hover over a field to see its type, whether it is required, its default and allowed values, and its description.
  • Explain — press F1, or choose Explain in the hover — opens a panel under the editor with the field at the cursor: its documentation and the list of its fields; choose a field to go down, Up to go back to the parent, Close to close it. It shows what kubectl explain <kind>.<path> would, for the version your cluster serves.

Where the schema comes from

From the cluster's OpenAPI v3 (/openapi/v3), read by Sextant's backend with your credentials, one API group and version at a time, when an editor first needs a kind of it. Sextant keeps a compact form of it in memory (the last 12 group/versions of the last 4 clusters), and the editor gets only the one kind it edits, so a large document never reaches the window. The schema is read again after a reconnect and when the cluster's kinds change (a CRD was installed or updated). Nothing is written to disk.

Kinds the cluster does not serve are never asked for, so a half-typed kind: does nothing until it names a real kind.

Without a schema

The editor stays a normal YAML editor, and everything else works as before, when:

  • the cluster does not publish OpenAPI v3 (Kubernetes before 1.24 by default), or the kind is not served — a note says The cluster publishes no schema for …;
  • reading the schema failed (Sextant tries again after 30 seconds);
  • the cluster is disconnected and the kind was never read. A schema read earlier keeps working while disconnected.

Keyboard

Key What it does
Ctrl+Space Show completions
Enter Accept the completion
F1 Explain the field at the cursor
Escape Close the completion list

AI agents (MCP) and extensions get nothing new from this feature.

Clone this wiki locally