Document for exec command api endpoint?

i cannot found any exec command apiserver endpoint in kubernetes pages. In particular, it is worse if it is not a pod. I could not find the contents of the command to exec for deployment anywhere.

kubectl exec deploy/[deploymentname] -- commands

Is there any documentation with information about this?

As far as I know you can’t run exec against any resource other than pods.

The API path is /api/v1/namespaces/{namespace}/pods/{name}/exec. Also it doesn’t appear to be documented. I had to find this by looking at the python client code.

The documentation can be found in the kubectlreference docs:

And some examples at:

You can run against a deployment, it will only be executed in the first pod:

❯ kubectl exec --help
Execute a command in a container.

  # Get output from running 'date' command from pod mypod, using the first container by default
  kubectl exec mypod -- date

To broadcast a command to all pods, you can always pipe the commands like:

❯ k get pods -l k8s-app=traefik -o name | xargs -n 1 -I {} echo kubectl exec {} comand
kubectl exec pod/kubone-k8s-traefik-ds-4d4xw comand
kubectl exec pod/kubone-k8s-traefik-ds-jjlgn comand

The API documentation is:

I saw that and wasn’t confident that was pods/{name}/exec. There’s HTTP Requests documented for things like eviction, status, ephemeralcontainers, and so on. Seems weird that exec doesn’t have something similar.

On another note, I’m slightly confused now as to if OP wanted API references or kubectl command references. Assumed the mention of using kubectl was demonstrating what OP wanted to do with the underlying API.