liveBook · Manning

Kubernetes API

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

The Kubernetes API is the interface through which Kubernetes resources and cluster operations are represented and accessed.

The Kubernetes API is the cluster’s RESTful interface for accessing resources and communicating with cluster components. The API server exposes it from the control plane. Users and tools reach the cluster through this entry point; worker nodes receive instructions through the control plane and report their status back. section 1.5 section 1.4.1

Resources such as Deployments are API objects with resource URIs. A Deployment comprises ReplicaSets, which run pods. Think of an API request as acting on a resource, rather than directly starting a container on a node. section 1.4.2 section 1.4.1

After authentication, HTTP methods express the requested operation:

  • GET retrieves resource data; POST creates a resource. section 1.4.2
  • PATCH updates part of a resource; PUT replaces it; DELETE removes it. section 1.4.2
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  containers:
  - image: nginx
    name: nginx

This Pod manifest shows the resource fields supplied in YAML: apiVersion, kind, metadata, and spec. It describes the requested pod before a command sends it to the cluster. section 1.9

Create and check a resource

Run `kubectl create -f my-pod-manifest.yaml`; the shown result is `pod/nginx created`. Use `kubectl get po` to inspect pods afterward rather than treating the creation message as the only check. For API access, also account for authentication and RBAC permissions: users and service accounts may be allowed different operations. section 1.9 section 2.1.2 section 9.3.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains resource URIs, REST methods, the API server, and access control, without detailing request processing internals.
Examples
Uses a JSON resource request as an analogy and a YAML Pod manifest created with kubectl.
What it assumes
Introduces REST operations through a resource-request example while relying on basic familiarity with pods and containers.
What you can do after
Apply it via kubectl to create a Pod from a manifest and inspect pods, while considering API permissions.
How it connects
Connects to the control plane, Deployments, pods, kubectl, authentication, and role-based access control.

Also explained in

Compare how 6 books explain Kubernetes API →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.