API discovery and REST identity
From object type to API endpoint
Kubernetes exposes a resource-oriented HTTP API. A GroupVersionKind (GVK) tells a client which representation an object uses; a GroupVersionResource (GVR) identifies the resource collection exposed through the API. For example, apps/v1 Deployment is a GVK, whereas apps/v1 deployments is a GVR. The plural is discovered, not derived mechanically from the Kind. The API server also advertises whether a resource belongs to a namespace. A client uses this information to choose the correct request path. All requests and responses here are static illustrations, not commands to execute against a cluster.
GVK: apps / v1 / DeploymentGVR: apps / v1 / deploymentsGET /apis/apps/v1/namespaces/book-lab/deployments/catalogCore resources and grouped resources
The original core group has no group name in the path. Its v1 Pods are served beneath /api/v1. Named groups use /apis followed by the group and version. Namespaced object paths contain namespaces and the namespace name; a cluster-scoped object such as a Node does not. A namespaced collection can also be listed across namespaces, subject to authorization. A Namespace itself is cluster-scoped. The following requests identify three different objects; none implies that the caller has access.
GET /api/v1/namespaces/book-lab/pods/catalog-aGET /apis/apps/v1/namespaces/book-lab/deployments/catalogGET /api/v1/nodes/worker-aDiscover resources and schemas separately
Discovery describes what resources the server serves, including names, kinds, scope and supported verbs. A traditional discovery client can read /api and /apis and then query the group-version endpoints. Modern servers also support aggregated discovery with the appropriate content negotiation. OpenAPI describes request and response structures; the v3 index links to group-version schemas. Use the actual server discovery and schema for extensions rather than assuming a resource is installed. Neither discovery nor OpenAPI proves that a particular identity is authorized or that an admission policy will accept an object.
{ "groupVersion": "apps/v1", "resources": [ { "name": "deployments", "namespaced": true, "kind": "Deployment", "verbs": [ "get", "list", "watch", "create", "update", "patch", "delete" ] }, { "name": "deployments/scale", "namespaced": true, "kind": "Scale", "group": "autoscaling", "version": "v1", "verbs": [ "get", "patch", "update" ] } ]}Subresources and object identity
Some operations are exposed at additional endpoints, such as deployments/catalog/scale or deployments/catalog/status. The former may return a Scale representation from another API group, while the parent remains a Deployment. Authorization and supported verbs may differ by subresource. A GET maps to the get verb on an individual object and list on a collection; a watch request uses the watch verb. A name is reusable after deletion. UID identifies a particular object lifetime within a cluster; the group/resource, namespace and name identify the address, not the lifetime. Switching the served API version does not by itself create a different stored object.
GET /apis/apps/v1/namespaces/book-lab/deployments/catalog/scalefirst object: name=catalog uid=uid-alater object: name=catalog uid=uid-bSame address, different object lifetime.Practice: build paths from discovery
Open discovery.json and path-cases.json in lab-fixtures/api-machinery. Derive each path, including a collection across namespaces and the Scale subresource. Reject an unknown resource and a namespace supplied for a cluster-scoped object. Explain why a resource being discoverable is not permission to read it. The local validator checks path assembly for this small fixture, not every Kubernetes API endpoint. Next, follow objects through list and watch.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
API discovery and REST identity — knowledge check
Interpret synthetic Kubernetes API evidence.
What does apps/v1/deployments identify?
Which path identifies a core Pod?
Which evidence lists supported resource verbs and scope?
Which endpoint reads the replica count interface of a Deployment?
A deleted Pod name is reused. What distinguishes the two lifetimes?