programming kubernetes chapter 2 - kube api server [43939030]
Tags: hausenblas - programming kubernetes
Kube API basics
-
Core responsbilities
- serve the Kube API -> reading/manipluating state, usually in etcd
- proxy cluster components
1. HTTP Interface
1. 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
-
2. GVR and GVK
2. GVR and GVK
-
Group Version Resource (GVR)
- Uniquely identifies a HTTP path
-
Group Version Kind (GVK)
- what a GVR returns
3. Special Notes
3. Special Notes
api/v1exists outside ofapisas 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
4. API server internals
4. 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