Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there API documentation for Kubelet API

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?

like image 744
adrian Avatar asked Jan 29 '16 01:01

adrian


People also ask

How do I access my Kubelet API?

From the Kubelet documentation: ensure the authorization.k8s.io/v1beta1 API group is enabled in the API server. start the kubelet with the --authorization-mode=Webhook and the --kubeconfig flags.

Does kubectl use REST API?

Directly accessing the REST APIkubectl handles locating and authenticating to the API server. If you want to directly access the REST API with an http client like curl or wget , or a browser, there are multiple ways you can locate and authenticate against the API server: Run kubectl in proxy mode (recommended).

How can I know my Kubernetes API?

If you would like to query the API without an official client library, you can run kubectl proxy as the command of a new sidecar container in the Pod. This way, kubectl proxy will authenticate to the API and expose it on the localhost interface of the Pod, so that other containers in the Pod can use it directly.

How do you monitor a Kubelet?

In order to track Kubelet in Sysdig monitor, you have to add some sections to the agent yaml configuration file. Then, you configure how the Sysdig agent will scrape the metrics, searching the system for processes called kubelet and scraping in localhost through port 10255.


1 Answers

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",
}
like image 173
E235 Avatar answered Sep 26 '22 01:09

E235