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 showing in above picture, when you run the kubectl command, the kubectl utility reaching the api server. The kube api server first authenticates the request and validate, and then it retrieve the data from ETCD cluster and gives response to kubectl. We can also sending post request to kube api server instead of using 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 api server creates new pod object without assigning it to the node and updates the information in the ETCD server and updates to user that pod is created.
The scheduler continuously monitor 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 api server. Now api server will update the information in ETCD cluster and then passes 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 ETCD cluster.
This similar pattern is followed every time when a change is requested.
- Kube api server is the only component that interacts directly to the ETCD data store.
- The other components such as scheduler, kuberctl, kubelet etc uses kube api server to perform updated in the cluster in their respective areas.