1 minute read

The Kube API Server is the central component of the Kubernetes Control Plane. It provides the API through which users and other Kubernetes components communicate with the cluster.

For example, when we run:

kubectl get nodes -A

kubectl sends the request to the Kube API Server. The API Server authenticates and validates the request, retrieves the required information from etcd, and returns the response.

Request Flow

A simplified request flow looks like this:

              kubectl
                 │
                 ▼
          Kube API Server
          │      │      │
          │      │      └── Authentication / Authorization
          │      │
          │      └───────── Validation
          │
          ▼
         etcd

The API Server is also responsible for coordinating communication between Kubernetes components.

Example: Creating a Pod

When a Pod is created:

kubectl
   │
   ▼
API Server
   │
   ├── Authenticate
   ├── Validate
   │
   ▼
etcd
   │
   ▼
Scheduler
   │
   ▼
API Server
   │
   ▼
Kubelet
   │
   ▼
Container Runtime
   │
   ▼
Pod

The API Server first validates and stores the Pod information in etcd. The Scheduler detects that the Pod has not been assigned to a node, selects a suitable worker node, and informs the API Server. The API Server then communicates the assignment to the Kubelet, which creates the Pod through the container runtime.

Main Responsibilities of Kube API Server

The Kube API Server:

  • Authenticates requests
  • Authorizes requests
  • Validates requests
  • Reads and writes cluster state in etcd
  • Provides the Kubernetes API
  • Coordinates communication between Kubernetes components

How to Inspect the API Server

With a kubeadm-based cluster, the API Server runs as a Pod in the kube-system namespace:

kubectl get pods -n kube-system

We should see a Pod similar to:

kube-system   kube-apiserver-master   1/1   Running

We can inspect its configuration through its Pod manifest or, in some installations, its systemd service:

cat /etc/systemd/system/kube-apiserver.service

Important Relationship

Component Role
kubectl Sends requests to the API Server
API Server Processes and coordinates API requests
etcd Stores the cluster state
Scheduler Assigns Pods to nodes
Kubelet Runs Pods on worker nodes

Key Takeaway

The Kube API Server is the central gateway to the Kubernetes cluster.

Almost every interaction with the Kubernetes cluster goes through the API Server. It authenticates and validates requests, communicates with etcd, and coordinates with components such as the Scheduler and Kubelet.