<p>A Kubelet has several endpoint paths it listens on, such as <code>/metrics</code>, <code>/metrics/cadvisor</code>, <code>/logs</code>, etc. One can easily query these endpoints by running <code>kubectl get --raw /api/v1/nodes/&lt;node-name&gt;/proxy/&lt;path&gt;</code> (after running <code>kubectl proxy</code>).</p>
<p>My question is how can one obtain the list of all these paths that Kubelet is serving? A list can be found in the Kubelet's own code <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/server/server.go#L84" rel="nofollow noreferrer">here</a>, but that's just a subset. There's for example <code>/pods</code> which is not on that list, but defined further down in <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/server/server.go#L342" rel="nofollow noreferrer">the code as well</a>. But there are others that aren't explicitly listed in the code, such as <code>/healthz</code>, which one guesses by looking at <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/server/server.go#L333" rel="nofollow noreferrer">other lines of the code</a>. I'd also venture to believe that other addons or 3rd party products could result in the Kubelet exposing more paths.</p>
<p>I tried using <code>/healthz?verbose</code>, but it only returns basic information, and nothing near a list of paths:</p>
<pre><code>[+]ping ok
[+]log ok
[+]syncloop ok
healthz check passed
</code></pre>
<p>The Kubernetes API Server returns a very nice list of paths using <code>kubectl get --raw /</code> as seen below (truncated due to length). Is there something equivalent for Kubelet's own paths?</p>
<pre><code>{
  &quot;paths&quot;: [
    &quot;/.well-known/openid-configuration&quot;,
    &quot;/api&quot;,
    &quot;/api/v1&quot;,
    &quot;/apis&quot;,
    &quot;/apis/&quot;,
    &quot;/apis/admissionregistration.k8s.io&quot;,
    &quot;/apis/admissionregistration.k8s.io/v1&quot;,
    &quot;/apis/admissionregistration.k8s.io/v1beta1&quot;,
    &quot;/apis/apiextensions.k8s.io&quot;,
    &quot;/apis/apiextensions.k8s.io/v1&quot;,
    &quot;/apis/apiextensions.k8s.io/v1beta1&quot;,
    &quot;/apis/apiregistration.k8s.io&quot;,
    &quot;/apis/apiregistration.k8s.io/v1&quot;,
    &quot;/apis/apiregistration.k8s.io/v1beta1&quot;,
    &quot;/apis/apps&quot;,
    &quot;/apis/apps/v1&quot;,
    &quot;/apis/authentication.k8s.io&quot;,
    &quot;/apis/authentication.k8s.io/v1&quot;,
    &quot;/apis/authentication.k8s.io/v1beta1&quot;,
    &quot;/apis/authorization.k8s.io&quot;,
    &quot;/apis/authorization.k8s.io/v1&quot;,
    &quot;/apis/authorization.k8s.io/v1beta1&quot;,
    &quot;/apis/autoscaling&quot;,
    &quot;/apis/autoscaling/v1&quot;,
    &quot;/apis/autoscaling/v2beta1&quot;,
    &quot;/apis/autoscaling/v2beta2&quot;,
    &quot;/apis/batch&quot;,
    &quot;/apis/batch/v1&quot;,
    &quot;/apis/batch/v1beta1&quot;,
    &quot;/apis/certificates.k8s.io&quot;,
....
</code></pre>

Mihai Albert
<p>Based on the information from different sources, below provided some endpoints for kubelet.</p>
<p>From the code of <a href="https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/kubelet/server/server.go#L85" rel="nofollow noreferrer">kubelet server</a>:</p>
<pre><code>/metrics
/metrics/cadvisor
/metrics/resource
/metrics/probes
/stats/
/logs/
/debug/pprof/
/debug/flags/v
</code></pre>
<p><a href="https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/kubelet/server/server.go#L342" rel="nofollow noreferrer">also</a>:</p>
<pre><code>/pods/*
</code></pre>
<p><a href="https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/kubelet/server/server.go#L409" rel="nofollow noreferrer">and</a>:</p>
<pre><code>/run/*
/exec/*
/attach/*
/portForward/*
/containerLogs/*
/configz
/runningpods/
</code></pre>
<p><a href="https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/kubelet/server/auth_test.go#L108" rel="nofollow noreferrer">here</a>:</p>
<pre><code>&quot;/attach/{podNamespace}/{podID}/{containerName}&quot;:       &quot;proxy&quot;,
&quot;/attach/{podNamespace}/{podID}/{uid}/{containerName}&quot;: &quot;proxy&quot;,
&quot;/configz&quot;: &quot;proxy&quot;,
&quot;/containerLogs/{podNamespace}/{podID}/{containerName}&quot;: &quot;proxy&quot;,
&quot;/debug/flags/v&quot;:                                     &quot;proxy&quot;,
&quot;/debug/pprof/{subpath:*}&quot;:                           &quot;proxy&quot;,
&quot;/exec/{podNamespace}/{podID}/{containerName}&quot;:       &quot;proxy&quot;,
&quot;/exec/{podNamespace}/{podID}/{uid}/{containerName}&quot;: &quot;proxy&quot;,
&quot;/healthz&quot;:                            &quot;proxy&quot;,
&quot;/healthz/log&quot;:                        &quot;proxy&quot;,
&quot;/healthz/ping&quot;:                       &quot;proxy&quot;,
&quot;/healthz/syncloop&quot;:                   &quot;proxy&quot;,
&quot;/logs/&quot;:                              &quot;log&quot;,
&quot;/logs/{logpath:*}&quot;:                   &quot;log&quot;,
&quot;/metrics&quot;:                            &quot;metrics&quot;,
&quot;/metrics/cadvisor&quot;:                   &quot;metrics&quot;,
&quot;/metrics/probes&quot;:                     &quot;metrics&quot;,
&quot;/metrics/resource&quot;:                   &quot;metrics&quot;,
&quot;/pods/&quot;:                              &quot;proxy&quot;,
&quot;/portForward/{podNamespace}/{podID}&quot;: &quot;proxy&quot;,
&quot;/portForward/{podNamespace}/{podID}/{uid}&quot;:         &quot;proxy&quot;,
&quot;/run/{podNamespace}/{podID}/{containerName}&quot;:       &quot;proxy&quot;,
&quot;/run/{podNamespace}/{podID}/{uid}/{containerName}&quot;: &quot;proxy&quot;,
&quot;/runningpods/&quot;:  &quot;proxy&quot;,
&quot;/stats/&quot;:        &quot;stats&quot;,
&quot;/stats/summary&quot;: &quot;stats&quot;
</code></pre>
<p>The asterisk indicates that full request should be updated with some parameters. For example for <code>/containerLogs/*</code> with adding <code>/{podNamespace}/{podID}/{containerName}</code>:</p>
<pre><code>kubectl get --raw /api/v1/nodes/&lt;node-name&gt;/proxy/containerLogs/{podNamespace}/{podID}/{containerName}
</code></pre>
<p>Some information <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet-authentication-authorization/#kubelet-authorization" rel="nofollow noreferrer">from kubernetes site about kubelet API</a>:</p>
<pre><code>/stats/*
/metrics/*
/logs/*
/spec/*
</code></pre>
<p>Also you can look at this page from <a href="https://github.com/cyberark/kubeletctl/blob/master/API_TABLE.md" rel="nofollow noreferrer">kubeletctl</a>. It's a bit outdated, but may provide some useful information about the kubelet API and HTTP requests.</p>
<p>And this <a href="https://www.deepnetwork.com/blog/2020/01/13/kubelet-api.html" rel="nofollow noreferrer">article about the kubelet API</a> is good too.</p>
<p>In any case, it is recommended to check the kubernetes documentation before using it to see what is deprecated in current / old releases.</p>
<p>p.s. If you are interested in this topic, you can create an issue on <a href="https://github.com/kubernetes/kubernetes/issues" rel="nofollow noreferrer">kubernetes GitHub page</a> to propose an improvement for kubelet documentation.</p>
