Skip to content

Commit 836bbb7

Browse files
authored
Merge pull request #37610 from windsonsea/ctlsheet
[zh] sync /kubectl/cheatsheet.md
2 parents 93f9481 + 58f71dc commit 836bbb7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

content/zh-cn/docs/reference/kubectl/cheatsheet.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,8 @@ kubectl logs -f my-pod -c my-container # stream pod container logs
670670
kubectl logs -f -l name=myLabel --all-containers # stream all pods logs with label name=myLabel (stdout)
671671
kubectl run -i --tty busybox --image=busybox:1.28 -- sh # Run pod as interactive shell
672672
kubectl run nginx --image=nginx -n mynamespace # Start a single instance of nginx pod in the namespace of mynamespace
673-
kubectl run nginx --image=nginx # Run pod nginx and write its spec into a file called pod.yaml
674-
--dry-run=client -o yaml > pod.yaml
675-
673+
kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml
674+
# Generate spec for running pod nginx and write it into a file called pod.yaml
676675
kubectl attach my-pod -i # Attach to Running Container
677676
kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod
678677
kubectl exec my-pod -- ls / # Run command in existing pod (1 container case)
@@ -694,8 +693,8 @@ kubectl logs -f my-pod -c my-container # 流式输出 Pod 容器的
694693
kubectl logs -f -l name=myLabel --all-containers # 流式输出含 name=myLabel 标签的 Pod 的所有日志(标准输出)
695694
kubectl run -i --tty busybox --image=busybox:1.28 -- sh # 以交互式 Shell 运行 Pod
696695
kubectl run nginx --image=nginx -n mynamespace # 在 “mynamespace” 命名空间中运行单个 nginx Pod
697-
kubectl run nginx --image=nginx # 运行 nginx Pod 并将其规约写入到名为 pod.yaml 的文件
698-
--dry-run=client -o yaml > pod.yaml
696+
kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml
697+
# 为运行 nginx Pod 生成规约并将其写入到名为 pod.yaml 的文件
699698

700699
kubectl attach my-pod -i # 挂接到一个运行的容器中
701700
kubectl port-forward my-pod 5000:6000 # 在本地计算机上侦听端口 5000 并转发到 my-pod 上的端口 6000

0 commit comments

Comments
 (0)