How to: Understanding the API
When you deploy Kubernetes, you get a cluster. See [Kubernetes cluster components](https://kubernetes.io/docs/concepts/overview/components) for more details.
kubectl
flow diagram
![kubectl flow diagram from medium.com](https://user-images.githubusercontent.com/17856665/188337178-851605cc-838e-4c0c-987c-c1f43a42abd0.png)
kubectl forwards command to the API Server
API Server validates the request and persists it to etcd
etcd notifies the API Server
API Server invokes the Scheduler
Scheduler will lookup eligible nodes to run the pod and return that to the API Server
API Server persists it to etcd
etcd notifies the API Server
API Server invokes the Kubelet in the corresponding node
Kubelet talks to the Docker daemon using the API over the Docker socket to create the container
Kubelet updates the pod status to the API Server (success or failure, failure invokes RestartPolicy)
API Server persists the new state in etcd
Use `kubectl api-resources | less` for an overview of available API resources.

- `APIVERSION`
  - `v1` core Kubernetes API group
  - `apps/v1` first extension to the core group
  - during deprecation/transition, multiple versions of the same resource may be available, e.g. `policy/v1` and `policy/v1beta1`
- `NAMESPACED` controls visibility

> The Kubernetes **release cycle is 3 months** and deprecated features are supported for a minimum of 2 release cycles (6 months).
> Respond to deprecation message swiftly, you may use **`kubectl api-versions`** to view a short list of API versions and **`kubectl explain --recursive`** to get more details on affected resources. \
> The current API docs at time of writing is `https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/`

#### kube-apiserver

The [Kubernetes API server `kube-apiserver`](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) is the interface to access all Kubernetes features, which include pods, services, replicationcontrollers, and others.

From within a Pod, the API server is accessible via a Service named `kubernetes` in the `default` namespace. Therefore, Pods can use the **`kubernetes.default.svc`** hostname to query the API server.

#### kube-proxy

In our minikube lab so far, we have been working with direct access to a cluster node, which removes the need for `kube-proxy`. When using the Kubernetes CLI `kubectl`, it uses stored TLS certificates in `~/.kube/config` to make secured requests to the `kube-apiserver`.

However, direct access is not always possible with K8s in the cloud. The [Kubernetes network proxy `kube-proxy`](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/) runs on each node and make it possible to access `kube-apiserver` securely by other applications like `curl` or programmatically.

> See the [official _so many proxies_ docs](https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#so-many-proxies) for the different proxies you may encounter when using Kubernetes.

```sh