Skip to content

Commit 84ed130

Browse files
authored
Merge pull request #25797 from yuandongx/patch-3
[zh] Sync cheatsheet.
2 parents 51baa51 + 2afa454 commit 84ed130

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ kubectl config unset users.foo # 删除用户 foo
153153
参见 [Kubectl 文档](https://kubectl.docs.kubernetes.io)
154154

155155
<!--
156-
## Creating Objects
156+
## Creating objects
157157
158158
Kubernetes manifests can be defined in YAML or JSON. The file extension `.yaml`,
159159
`.yml`, and `.json` can be used.
@@ -567,8 +567,7 @@ kubectl scale --replicas=5 rc/foo rc/bar rc/baz # 伸缩多个
567567
kubectl delete -f ./pod.json # Delete a pod using the type and name specified in pod.json
568568
kubectl delete pod,service baz foo # Delete pods and services with same names "baz" and "foo"
569569
kubectl delete pods,services -l name=myLabel # Delete pods and services with label name=myLabel
570-
kubectl delete pods,services -l name=myLabel # Delete pods and services with label name=myLabel
571-
kubectl -n my-ns delete pod,svc --all # Delete all pods and services in namespace my-ns,
570+
kubectl -n my-ns delete pod,svc --all # Delete all pods and services in namespace my-ns,
572571
# Delete all pods matching the awk pattern1 or pattern2
573572
kubectl get pods -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs kubectl delete -n mynamespace pod
574573
```
@@ -599,14 +598,15 @@ kubectl logs -f my-pod # stream pod logs (stdout)
599598
kubectl logs -f my-pod -c my-container # stream pod container logs (stdout, multi-container case)
600599
kubectl logs -f -l name=myLabel --all-containers # stream all pods logs with label name=myLabel (stdout)
601600
kubectl run -i --tty busybox --image=busybox -- sh # Run pod as interactive shell
602-
kubectl run nginx --image=nginx -n
601+
kubectl run nginx --image=nginx -n
603602
mynamespace # Run pod nginx in a specific namespace
604603
kubectl run nginx --image=nginx # Run pod nginx and write its spec into a file called pod.yaml
605604
--dry-run=client -o yaml > pod.yaml
606605
607606
kubectl attach my-pod -i # Attach to Running Container
608607
kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod
609608
kubectl exec my-pod -- ls / # Run command in existing pod (1 container case)
609+
kubectl exec --stdin --tty my-pod -- /bin/sh # Interactive shell access to a running pod (1 container case)
610610
kubectl exec my-pod -c my-container -- ls / # Run command in existing pod (multi-container case)
611611
kubectl top pod POD_NAME --containers # Show metrics for a given pod and its containers
612612
```
@@ -629,6 +629,7 @@ kubectl run nginx --image=nginx # 运行 ngins Pod 并将其
629629
kubectl attach my-pod -i # 挂接到一个运行的容器中
630630
kubectl port-forward my-pod 5000:6000 # 在本地计算机上侦听端口 5000 并转发到 my-pod 上的端口 6000
631631
kubectl exec my-pod -- ls / # 在已有的 Pod 中运行命令(单容器场景)
632+
kubectl exec --stdin --tty my-pod -- /bin/sh # 使用交互 shell 访问正在运行的 Pod (一个容器场景)
632633
kubectl exec my-pod -c my-container -- ls / # 在已有的 Pod 中运行命令(多容器场景)
633634
kubectl top pod POD_NAME --containers # 显示给定 Pod 和其中容器的监控数据
634635
```
@@ -661,7 +662,7 @@ kubectl cluster-info # 显示
661662
kubectl cluster-info dump # 将当前集群状态转储到标准输出
662663
kubectl cluster-info dump --output-directory=/path/to/cluster-state # 将当前集群状态输出到 /path/to/cluster-state
663664

664-
# 如果已存在具有指定键和效果的污点,则替换其值为指定值
665+
# 如果已存在具有指定键和效果的污点,则替换其值为指定值
665666
kubectl taint nodes foo dedicated=special-user:NoSchedule
666667
```
667668

0 commit comments

Comments
 (0)