Use this when automation talks to the Kubernetes API directly.
Kubernetes API
1. The Kubernetes API is declarative and resource-based.
2. Clients: kubectl, client libraries, controllers.
3. RBAC controls access.
4. Use server-side apply.
5. Watch API deprecations.
client → API server → etcd → controllers
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
For Kubernetes Automation → Kubernetes API, the evidence must connect the control-plane result to the Kubernetes object plus controller-owned workload/network/config state it represents and explain any gap between desired, controller-reported and consumer-visible state.
Step 2 Common mistakes Narrow the fault
- Using admin kubeconfigs for automation.
Step 3 Where it fails Narrow the fault
Failure analysis for Kubernetes Automation → Kubernetes API should follow the path through the components: manifest/client → API server → admission → persisted object → controller reconciliation → node/workload/service state → status/read-back.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
kubectl api-resources— available resourceskubectl get --raw /healthz— API healthkubectl auth can-i create deployments -n <ns>— permission check
ReferenceWhy it matters1 section · depth on demand
In depth
The Kubernetes API is the single entry point for everything in a cluster: kubectl, controllers, operators and automation all read and write resources through it. Understanding it makes any Kubernetes automation — scripts, CI pipelines, custom controllers — straightforward.
kubectl api-resources # resource types and API groups
kubectl explain deployment.spec.strategy # field documentation
kubectl get --raw /apis/apps/v1/namespaces/tools/deployments | jq '.items[].metadata.name'
kubectl auth can-i create jobs -n tools --as=system:serviceaccount:ci:deployer
from kubernetes import client, config
config.load_kube_config()
for d in client.AppsV1Api().list_namespaced_deployment("tools").items:
print(d.metadata.name, d.status.ready_replicas)
Automation should use a dedicated service account with RBAC limited to the namespaces and verbs it needs.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Kubernetes Automation → Kubernetes API is owned at runtime by the Kubernetes API server, admission chain and relevant controllers/reconcilers. Its durable intent is versioned Kubernetes API objects and automation logic applied to an explicit cluster/namespace; the stable identity contract is cluster, namespace, kind, name/UID, resourceVersion and generation. The linked authority for bounded mechanics is Kubernetes Documentation; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Kubernetes Automation > Kubernetes API. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://kubernetes.io/docs/home/ · confidence 94%