cyberark / kubeletctl

A client for kubelet
Apache License 2.0
736 stars 83 forks source link

Add support for kubelet HTTP endpoints #1

Closed yuvalavra closed 4 years ago

yuvalavra commented 4 years ago

The kubelet readonly server (normally at :10255) listens for HTTP. The kubelet main server (normally at :10250) will also listen for HTTP when no TLS configuration is specified. When attempting to issue commands through kubeletctl to a kubelet's HTTP endpoint, the following error occurs:

$ kubeletctl --server 127.0.0.1 --port 10255 pods
[*] Failed to run HTTP request with error: Get https://127.0.0.1:10255/pods: http: server gave HTTP response to HTTPS client

$ curl http://127.0.0.1:10255/pods # works
{"kind":"PodList","apiVersion":"v1", ... }

Consider adding support for HTTP, perhaps through a cmdline flag.

Also, great tool (:

g3rzi commented 4 years ago

Hi @YuvalAvra, thanks for the feedback! :)

I did some changes and added new flag --http and support on any port, it seems to work on my side, I will appreciate if you can check it again and let me know if it works on your side too.

By the way, the default IP is 127.0.0.1 so you don't need to use -s, you can use it like that:

kubeletctl --http --port 10255 pods

I uploaded a new version v1.2:

curl -LO https://github.com/cyberark/kubeletctl/releases/download/v1.2/kubeletctl_linux_amd64 && chmod a+x ./kubeletctl_linux_amd64 && mv ./kubeletctl_linux_amd64 /usr/local/bin/kubeletctl
yuvalavra commented 4 years ago

Thanks for the quick response, works on my side