Kubernetes Objects

247

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

Stuff you wanna know:

  1. Kubernetes Objects describe what containerized applications are running (and on which nodes), the resources available to those applications, and the policies around how those applications behave (such as restart policies, upgrades, and fault-tolerance).
  2. A Kubernetes object is a “record of intent”–once you create the object, the Kubernetes system will constantly work to ensure that object exists.
  3. By creating an object, you’re effectively telling the Kubernetes system what you want your cluster’s workload to look like; this is your cluster’s desired state.
  4. To work with Kubernetes objects–whether to create, modify, or delete them–you’ll need to use the Kubernetes API.
  5. The kubectl tool supports three kinds of object management — Imperative commands, Imperative object configuration, and Declarative object configuration.
  6. The create, replace, and delete commands work well when each object’s configuration is fully defined and recorded in its configuration file. However when a live object is updated, and the updates are not merged into its configuration file, the updates will be lost the next time a replace is executed.
  7. When you use the kubectl command-line interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use the Kubernetes API directly in your own programs using one of the Client Libraries.
  8. Almost every Kubernetes object includes two nested object fields that govern the object’s configuration: the object specand the object status.
  9. When you create an object in Kubernetes, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name).
  10.  Kubernetes objects can be created, updated, and deleted by storing multiple object configuration files in a directory and using kubectl apply to recursively create and update those objects as needed.
  11. Each object in your cluster has a Name that is unique for that type of resource.
  12. Every Kubernetes object has a UID that is unique across your whole cluster.
  13. For non-unique user-provided attributes, Kubernetes provides labels and annotations.
  14. Only one object of a given kind can have a given name at a time. However, if you delete the object, you can make a new object with the same name.
  15. Most resource types require a name that can be used as a DNS subdomain name.
  16. A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.
  17. Kubernetes objects can be created, updated, and deleted directly using imperative commands built into the kubectl command-line tool.
  18.  The kubectl tool supports verb-driven commands for creating some of the most common object types.
  19. The kubectl tool supports creation commands driven by object type. These commands support more object types and are more explicit about their intent, but require users to know the type of objects they intend to create.
  20.  The kubectl command supports verb-driven commands for some common update operations.
  21. You can use kubectl delete for both imperative commands and imperative object configuration.
  22. When using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.
  23. In imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.
  24. When using declarative object configuration, a user operates on object configuration files stored locally, however the user does not define the operations to be taken on the files. Create, update, and delete operations are automatically detected per-object by kubectl.
  25. Declarative object configuration retains changes made by other writers, even if the changes are not merged back to the object configuration file.
  26. Since 1.14, Kubectl also supports the management of Kubernetes objects using a kustomization file.
  27. A patch is an update operation that is scoped to specific fields of an object instead of the entire object. This enables updating only a specific set of fields on an object without reading the object first.

More stuff: