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?
You can run against a deployment, it will only be executed in the first pod:
❯ kubectl exec --help
Execute a command in a container.
Examples:
# 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
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.