# Api Server In this section, we will configure kubernetes API server. > The Kubernetes API server validates and configures data for the api objects which include pods, services, replicationcontrollers, and others. The API Server services REST operations and provides the frontend to the cluster's shared state through which all other components interact. As you can see from the description, api server is a central (not the main) component of kubernetes cluster. ![image](./img/05_cluster_architecture_apiserver.png "Kubelet") ## certificates Before we begin with the configuration of the api server, we need to create certificates for kubernetes that will be used to sign service account tokens. ```bash { cat > service-account-csr.json < /var/lib/kubernetes/encryption-config.yaml < ... ``` ## verify Now, when our server is up and running, we want to communicate with it. To do that we will use kubectl tool. So let's download and install it ```bash wget -q --show-progress --https-only --timestamping \ https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl \ && chmod +x kubectl \ && sudo mv kubectl /usr/local/bin/ ``` As the api server is configured in more or less secure mode, we need to provide some credentials when accessing it. We will use certificate files as the credentials. That is why we need to generate a proper certificate file that will allow us to access api server with administrator privileges ```bash { cat > admin-csr.json < pod.yaml apiVersion: v1 kind: Pod metadata: name: hello-world spec: serviceAccountName: hello-world containers: - name: hello-world-container image: busybox command: ['sh', '-c', 'while true; do echo "Hello, World!"; sleep 1; done'] nodeName: ${HOST_NAME} EOF cat < sa.yaml apiVersion: v1 kind: ServiceAccount metadata: name: hello-world automountServiceAccountToken: false EOF kubectl apply -f sa.yaml kubectl apply -f pod.yaml } ``` Note: as you can see, in addition to the pod, we create the service account associated with the pod. This step is needed as we have no default service account created in the default namespace (the service account controller is responsible to create it, but we didn't configure the controller manager yet). To check pod status run ```bash kubectl get pod ``` Output: ``` NAME READY STATUS RESTARTS AGE hello-world 0/1 Pending 0 29s ``` As expected we received the pod in a pending state, because we have now kubelet configured to run pods created in API server. We can veryfy that by running ```bash kubectl get nodes ``` Output: ``` NAME STATUS ROLES AGE VERSION ``` Next: [Apiserver - Kubelet integration](./06-apiserver-kubelet.md)