mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-05 13:46:00 +02:00
kubectl-run: add page (#6161)
This commit is contained in:
parent
09eb57be3d
commit
9619f7a3ba
1 changed files with 24 additions and 0 deletions
24
pages/common/kubectl-run.md
Normal file
24
pages/common/kubectl-run.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# kubectl run
|
||||
|
||||
> Run pods in Kubernetes. Specifies pod generator to avoid deprecation error in some K8S versions.
|
||||
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run>.
|
||||
|
||||
- Run an nginx pod and expose port 80:
|
||||
|
||||
`kubectl run --generator=run-pod/v1 nginx --image=nginx --port 80`
|
||||
|
||||
- Run an nginx pod, setting the TEST_VAR environment variable:
|
||||
|
||||
`kubectl run --generator=run-pod/v1 nginx --image=nginx --env="TEST_VAR=testing"`
|
||||
|
||||
- Show API calls that would be made to create an nginx container:
|
||||
|
||||
`kubectl run --generator=run-pod/v1 nginx --image=nginx --dry-run`
|
||||
|
||||
- Run an Ubuntu pod interactively, never restart it, and remove it when it exits:
|
||||
|
||||
`kubectl run --generator=run-pod/v1 -it temp-ubuntu --image=ubuntu:20.04 --restart=Never --rm -- /bin/bash`
|
||||
|
||||
- Run an Ubuntu pod, overriding the default command with echo, and specifying custom arguments:
|
||||
|
||||
`kubectl run --generator=run-pod/v1 temp-ubuntu --image=ubuntu:20.04 --command -- echo arg1 arg2 arg3`
|
Loading…
Add table
Reference in a new issue