6.09 Kubernetes API Groups
π― What is the Kubernetes API?
All cluster operations interact with the kube-apiserver:
kubectlcurl- Controllers
- Operators
- CI/CD systems
Example:
Note
Port 6443 is the default secure Kubernetes API port.
π Important Top-Level API Paths
| Path | Purpose |
|---|---|
| /version | Cluster version |
| /healthz | Health check |
| /metrics | Monitoring metrics |
| /logs | Logging integrations |
| /api | Core APIs |
| /apis | Named API groups |
π§© API Group Structure
Kubernetes APIs are divided into:
1οΈβ£ Core Group (/api)
Path example:
Core resources include:
- namespaces
- pods
- nodes
- services
- endpoints
- configmaps
- secrets
- persistentvolumes
- persistentvolumeclaims
- events
2οΈβ£ Named Groups (/apis)
Path example:
Common named groups:
| API Group | Example Resources |
|---|---|
| apps | deployments, replicasets, statefulsets |
| networking.k8s.io | networkpolicies |
| storage.k8s.io | storageclasses |
| authentication.k8s.io | tokenreviews |
| authorization.k8s.io | subjectaccessreviews |
| certificates.k8s.io | certificatesigningrequests |
Tip
All newer Kubernetes features are added under named API groups.
π Resources and Verbs
Each resource supports operations (verbs):
- list
- get
- create
- update
- delete
- watch
Example:
Supports:
- list deployments
- create deployment
- delete deployment
- watch deployment
π Discover API Groups
Discover root APIs:
Discover named groups:
π Authentication Required
Unauthenticated access:
Returns:
Authenticated access:
π kubectl proxy
Instead of manually passing certificates:
Starts local proxy:
Now:
Warning
kubectl proxy uses credentials from your kubeconfig file.
β kube-proxy vs kubectl proxy
| Component | Purpose |
|---|---|
| kube-proxy | Pod β Service networking inside cluster |
| kubectl proxy | Local HTTP proxy to API server |
Danger
These are completely different components.
π‘ Production Best Practices
β DO
Success
- Use RBAC to control verbs per API group
- Restrict access to sensitive groups (certificates, authorization)
- Monitor API server audit logs
- Use kubectl proxy only for debugging
- Disable anonymous authentication in production
- Secure API server with TLS
β DON'T
Danger
- Do NOT expose API server publicly without firewall
- Do NOT grant wildcard verbs (*)
- Do NOT allow cluster-admin unnecessarily
- Do NOT rely on anonymous API access
- Do NOT confuse kube-proxy with kubectl proxy
π¨ Production Risks
| Risk | Impact |
|---|---|
| Over-permissive RBAC | Privilege escalation |
| Exposed API endpoint | Full cluster compromise |
| Anonymous enabled | Unauthorized discovery |
| Excessive verbs | Data deletion / takeover |
π― Summary
- Kubernetes APIs are grouped into Core and Named
- Resources belong to groups
- Actions are defined as verbs
- Authorization policies use API groups + resources + verbs
- Secure API access is critical in production
Quote
API Groups define what exists.
Verbs define what you can do.
RBAC defines who can do it.