kubectl run
Run pods in Kubernetes. Specifies pod generator to avoid deprecation error in some K8S versions. More information: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/.
- Run an
nginxpod and expose port 80:
kubectl run --image nginx --port 80
- Run an
nginxpod, setting the$TEST_VARenvironment variable:
kubectl run --image nginx --env "="
- Simulate creating an
nginxcontainer, showing the API calls that would be made:
kubectl run --image nginx --dry-run=
- Run an Ubuntu pod interactively, never restart it, and remove it when it exits:
kubectl run --image ubuntu:22.04 --restart Never --rm -- /bin/bash
- Run an Ubuntu pod, overriding the default command with echo, and specifying custom arguments:
kubectl run --image ubuntu:22.04 --command -- echo
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
