Kubernetes - kube-apiserver
Last Updated: 2024-02-06
K8s API Server provides REST API.
The kubernetes
service (in default
namespace) is configured with a virtual IP address that is redirected (via kube-proxy
) to the HTTPS endpoint on the API server.
Check audit logging: /var/log/apiserver/*
Explore Kubernetes APIs
Use kubectl proxy
to create a proxy:
$ kubectl proxy --port=8081 &
From another terminal
curl http://localhost:8081/api
{
"kind": "APIVersions",
"versions": [
"v1"
],
"serverAddressByClientCIDRs": [
{
"clientCIDR": "0.0.0.0/0",
"serverAddress": "172.19.0.2:6443"
}
]
}
Get the full list of APIs
$ curl http://localhost:8081/apis
# OpenAPI:
$ curl http://localhost:8081/openapi/v2 | jq | less
$ curl http://localhost:8081/openapi/v3 | jq | less
OpenAPI support is in a separate repo: k8s.io/kube-openapi
. The api server (k8s.io/apiserver
) depends on kube-openapi