programming kubernetes chapter 2 - kube api server
Tags: hausenblas - programming kubernetes
Kube API basics
- Core responsbilities
- serve the Kube API -> reading/manipluating state, usually in etcd
- proxy cluster components
HTTP Interface
http interface provides 4 structures:
- Kinds
- Type of entity, each object has a kind
- usually 3 categories of kinds
- objects -> a persistent entity within the system
- lists -> 1 or more kinds
- special purpose -> for special actions, like status
- API Group
- collection of kinds that are logically related
- like
/apis/core
- Version
- each API group can (and likely does) exist as multiple versions
- All objects are either in one API version or none
- Resource
- lowercase, plural word that identifies a set of HTTP endpoints
- usually sends and receives a single kind
- can have subrouses, usually implemented with custom HTTP protocols like websockets
- always corresponds to an HTTP path
- lowercase, plural word that identifies a set of HTTP endpoints
GVR and GVK
- Group Version Resource (GVR)
- Uniquely identifies a HTTP path
- Group Version Kind (GVK)
- what a GVR returns
Special Notes
api/v1
exists outside ofapis
as a legacy holdover, should beapis/core/v1
- cluster wide entities have different values, such as
/metrics
,/logs
, and/healthz
- specs vs status
- specifications - desired state for a resource
- status - observed state for a resource
API server internals
Each API group has a specific handler, and there are 6 different phases internally
- Entry
- Authn/authz
- mutation admission -> this is where the incoming request can be transformed
- schema validation
- validating admission -> large part of the validation logic
- etcd