Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ The following compatible plugins are available:
kubectl curl [options] URL [container]
```

* In the URL, the host part must be the name of the pod to send the request to.
* If no port number is specified, the request will be sent to a `http` port.
* If there are multiple containers with a `http` port, the name of the container
* In the `URL`, the host part can be:
* **podName**: pod to send the request to
* a resource reference, such as **deployment/deploymentName**. The request is sent to a random pod from this resource.
* NOTE: supported resources: **deployment**, **statefulset**, **daemonset**
* NOTE: supported abbreviations: **deploy**, **sts**, **ds**
* If no port number is specified, the request will be sent to an `http` port.
* If there are multiple containers with an `http` port, the name of the container
to send to the request to must be specified after the URL.

## Examples
Expand All @@ -45,15 +49,32 @@ This section records common use cases for this kubectl plugin.
### Collecting profiles of Go programs

```
$ kubectl curl "http://{pod}/debug/pprof/profile?debug=1&seconds=10" > ./profile
$ kubectl curl "http://{podname}/debug/pprof/profile?debug=1&seconds=10" > ./profile
$ go tool pprof -http :6060 ./profile
```

* Full documentation: [net/http/pprof](https://pkg.go.dev/net/http/pprof)

### Retrieving prometheus metrics

All of these variants work:

```
$ kubectl curl http://{pod}/metrics
$ 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
...
```