Kube API Server
In this tutorial, we are going to discuss Kube API Server. The Kube API server is the entry point for all the REST commands used to control the cluster.
A user sends the rest commands to the API server, which then validates the requests, then processes and executes them. After requesting, the resulting state of the cluster is stored in the distributed key-value store.
This API Server is the only Kubernetes control panel component with a user-accessible API and the sole master component that you’ll interact with. It acts as a gateway to the cluster and support life cycle orchestration.
As shown in the above picture, when you run the kubectl command, the kubectl utility reaches the API server. The Kube API server first authenticates the request and validate, and then it retrieves the data from the ETCD cluster and gives a response to kubectl. We can also send a post request to the Kube API server instead of using the kubectl command-line utility.
Creating the pod
Let’s look at the example of creating the pod. The request is authenticated first and then validated.
In this case, the API server creates a new pod object without assigning it to the node, updates the information in the ETCD server, and updates to the user that pod is created.
The scheduler continuously monitors the API server and realizes that there is a new pod is created with no node assigned. The scheduler identifies the right node to place the new pod and communicates back to the API server.Â
Now the API server will update the information in the ETCD cluster and then pass that information to the kubelet in the appropriate worker node.
The kubelet agent now creates the pod on the node and instructs the container runtime engine to deploy the application image. Once it is done, the kubelet updates the status back to the API server, and the API server updates the data in the ETCD cluster.
This similar pattern is followed whenever a change is requested.
Note
- Kube API server is the only component that interacts directly with the ETCD data store.
- The other components, such as scheduler, kubectl, kubelet, etc., use the Kube API server to perform updates in the cluster in their respective areas.