In the context of the k8s api, the term “Resource” is abused and in most cases it’s used as a synonym for the term “Object”. This brings confusion, so I will try to clear things out.
What are Resources?
The term “Resource” comes from API Terminology. It is an asset on a server that an entity (user, program, etc.) could access through an API endpoint.
However, there are some nuances when it comes to Kubernetes parlance.
Resource Types
The k8s API docs extends the general API terminology by introducing Resource Types.
Here is the definition, straight from the Kubernetes API Terminology page:
A Resource Type is the name used in the URL (
pods,namespaces,services1)
Each Resource Type has a concrete representation referenced through the k8s kind field.
Here is an example endpoint (aka a Collection): /api/v1/pods.
IMPORTANT
A Collection is an API endpoint that represents a list of resources of the same type (Kind).
Sub-resources
The API provides additional functionality for some resource types through URI paths under the specific resource; these paths represent the so-called sub-resources.
Resource Instances
A single instance of a resource type is called a resource, and also usually represents an Object.
Note that singular resources are also known as Elements.
IMPORTANT
An Element is an API endpoint that represents an individual resource.
An example Element: /api/v1/pods/some-name.
some-name could be any given name, provided through the metadata.name field.
Footnotes
-
To understand what lies beyond the URL (what is a Pod in the context of the k8s API), see k8s objects. ↩