Kubectl 插件,用于执行针对 Kubernetes pod 的 curl 命令
Kubectl plugin to run curl commands against kubernetes pods
Sending http requests to kubernetes pods is unnecessarily complicated, this plugin makes it easy.
The plugin creates a port forwarding from the local network to the kubernetes pod that was selected to receive the request, then instantiate a curl command by rewriting the URL to connect to the forwarded local port, and passing all curl options that were given on the command line.
If $GOPATH/bin is in the PATH, the plugin can be installed with:
$ go install github.com/segmentio/kubectl-curl@latestIf it was installed properly, it will be visibile when listing kubectl plugins:
$ kubectl plugin list
The following compatible plugins are available:
/.../kubectl-curlkubectl curl [options] URL [container]URL, the host part can be:http port.http port, the name of the container
to send to the request to must be specified after the URL.This section records common use cases for this kubectl plugin.
$ kubectl curl "http://{podname}/debug/pprof/profile?debug=1&seconds=10" > ./profile
$ go tool pprof -http :6060 ./profileAll of these variants work:
$ kubectl curl http://{podname}/metrics
...
$ kubectl curl http://daemonset/{daemonsetname}/metrics
...
$ kubectl curl http://ds/{daemonsetname}/metrics
...
$ kubectl curl {podname}/metrics
...
$ kubectl curl daemonset/{daemonsetname}/metrics
...
$ kubectl curl ds/{daemonsetname}/metrics
...暂无开放 Issues,或尚未同步最近议题。