KCNA · Question #187
What fields must exist in any Kubernetes object (e.g. YAML) file?
The correct answer is A. apiVersion, kind, metadata. Every Kubernetes object definition, typically represented in YAML or JSON, requires apiVersion, kind, and metadata as top-level fields to correctly identify and manage the resource. These fields provide essential information about the object's type, version, and unique…
Question
What fields must exist in any Kubernetes object (e.g. YAML) file?
Options
- AapiVersion, kind, metadata
- Bkind, namespace, data
- CapiVersion, metadata, namespace
- Dkind, metadata, data
How the community answered
(43 responses)- A88% (38)
- B5% (2)
- C5% (2)
- D2% (1)
Why each option
Every Kubernetes object definition, typically represented in YAML or JSON, requires `apiVersion`, `kind`, and `metadata` as top-level fields to correctly identify and manage the resource. These fields provide essential information about the object's type, version, and unique identifiers.
All Kubernetes object definitions, whether in YAML or JSON, must include `apiVersion` to specify the Kubernetes API version, `kind` to define the type of object (e.g., Pod, Service, Deployment), and `metadata` to hold data that uniquely identifies the object within the cluster, such as its name and namespace. These fields are foundational for the Kubernetes API server to process and manage the resource.
`namespace` is part of `metadata`, and `data` is specific to certain objects like Secrets or ConfigMaps, not a universal required field.
`namespace` is a sub-field within `metadata`, not a top-level required field on its own, and `kind` is missing.
`data` is not a universally required field for all Kubernetes objects, and `apiVersion` is missing.
Concept tested: Kubernetes object basic structure
Source: https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/
Topics
Community Discussion
No community discussion yet for this question.