Kubernetes Objects

Kubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster.

A Kubernetes object is a “record of intent”—once you create the object, the Kubernetes system will constantly work to ensure that object exists.

To work with Kubernetes objects—whether to create, modify, or delete them—you’ll need to use the Kubernetes API.

Almost every Kubernetes object includes two nested object fields that govern the object’s configuration:

  • the object spec and
  • the object status. current state of the object,

Object structure

In the manifest (YAML or JSON file) for the Kubernetes object you want to create, you’ll need to set values for the following fields:

  • apiVersion - Which version of the Kubernetes API you’re using to create this object
  • kind - What kind of object you want to create
  • metadata - Data that helps uniquely identify the object, including a name string, UID, and optional namespace
  • spec - What state you desire for the object
    • The precise format of the object spec is different for every Kubernetes object, and contains nested fields specific to that object.