Is there API documentation for Kubelet API
It isn't documented anywhere (that I know of). I always end up reading the code to find out what endpoints exist.
Also note that unlike the API in the apiserver, there are no guarantees that the kubelet API will be stable between versions. Over time I expect that it will become properly versioned (and probably swaggerfied) and at that point we will provide documentation and a commitment to backward compatibility.
Some kubelet useful API to curl:
http://localhost:10255/podshttp://localhost:10255/stats/summaryhttp://localhost:10255/metrics
There is a new open-source project called kubeletctl.
It documents all the kubelet APIs (document and undocument).
You can use like that:
kubeletctl -s <node_ip> pods kubeletctl -s <node_ip> metrics cadvisor
When you run kubeletctl -h
you will see all the commands you can use, it also has sub-commands but you need to type the parent command and then add -h
, e.g kubeletctl metrics -h
.
Here are some of the APIs kubelet implements:
testPaths := map[string]string{ "/attach/{podNamespace}/{podID}/{containerName}": "proxy", "/attach/{podNamespace}/{podID}/{uid}/{containerName}": "proxy", "/configz": "proxy", "/containerLogs/{podNamespace}/{podID}/{containerName}": "proxy", "/cri/": "proxy", "/cri/foo": "proxy", "/debug/flags/v": "proxy", "/debug/pprof/{subpath:*}": "proxy", "/exec/{podNamespace}/{podID}/{containerName}": "proxy", "/exec/{podNamespace}/{podID}/{uid}/{containerName}": "proxy", "/healthz": "proxy", "/healthz/log": "proxy", "/healthz/ping": "proxy", "/healthz/syncloop": "proxy", "/logs/": "log", "/logs/{logpath:*}": "log", "/metrics": "metrics", "/metrics/cadvisor": "metrics", "/metrics/probes": "metrics", "/metrics/resource/v1alpha1": "metrics", "/pods/": "proxy", "/portForward/{podNamespace}/{podID}": "proxy", "/portForward/{podNamespace}/{podID}/{uid}": "proxy", "/run/{podNamespace}/{podID}/{containerName}": "proxy", "/run/{podNamespace}/{podID}/{uid}/{containerName}": "proxy", "/runningpods/": "proxy", "/spec/": "spec", "/stats/": "stats", "/stats/container": "stats", "/stats/summary": "stats", "/stats/{namespace}/{podName}/{uid}/{containerName}": "stats", "/stats/{podName}/{containerName}": "stats",}