RESTful API Conventions
What you'll learn: How Kubernetes organizes and exposes cluster resources through standardized REST principles and HTTP methods.
The REST Foundation
Kubernetes embraces RESTful (Representational State Transfer) conventions to make interacting with the cluster intuitive and predictable. Every resource—Pods, Services, Deployments—is treated as a distinct entity accessible through a structured URL path. This design means you can manage infrastructure the same way web APIs work: using familiar HTTP methods to read, create, update, or delete resources.
Resource Paths as Addresses
Think of the Kubernetes API like a file system where each resource type has its own organized path. For example:
/api/v1/namespaces/default/pods— all Pods in the default namespace/api/v1/nodes— all cluster Nodes/apis/apps/v1/deployments— all Deployments
These paths follow a predictable pattern: API group, version, optional namespace, resource type, and optional resource name.
HTTP Verbs Map to Actions
Kubernetes uses standard HTTP methods that align with CRUD operations:
- GET — retrieve resource details (read)
- POST — create a new resource
- PUT — replace an entire resource (full update)
- PATCH — modify specific fields (partial update)
- DELETE — remove a resource
When you run kubectl get pods, behind the scenes it sends a GET request to the appropriate resource path. Creating a Pod? That's a POST request with the Pod specification in the request body.
Why This Matters
This standardization means any HTTP client can interact with Kubernetes, not just kubectl. The API is self-documenting through its structure, and tooling can be built generically because conventions are consistent across all resource types.
Key Takeaway: Kubernetes uses REST conventions with hierarchical resource paths and standard HTTP verbs (GET, POST, PUT, PATCH, DELETE) to provide a consistent, predictable interface for managing all cluster resources.