Is there API documentation for Kubelet API

1/29/2016

I know that the Kubelet process on each Kubernetes node exposes a simple API server, but I cannot find any documentation for it.

Does someone know of a resource that has it?

-- adrian
kubelet
kubernetes

5 Answers

1/30/2016

Not documenting it is a way of saying: don't depend on this yet, it's a wip. Some parts, like cadvisor which is currently running as part of the kubelet binary, are actually more standardized. If there's some feature you'd really like to use but can't find docs on, I'd suggest asking on the kubernetes sig-node slack channel, or the sig-node mailing list

-- Prashanth B
Source: StackOverflow

4/30/2020

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",
}
-- E235
Source: StackOverflow

6/12/2018

Some kubelet useful API to curl:

http://localhost:10255/pods
http://localhost:10255/stats/summary
http://localhost:10255/metrics
-- Haoyuan Ge
Source: StackOverflow

1/29/2016

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.

-- Robert Bailey
Source: StackOverflow

11/1/2018

You can run this quick command to list out all api endpoints. You will need to have jq installed

kubectl get --raw "/" | jq

-- Boojs
Source: StackOverflow