Skip to content

Commit bb60c2f

Browse files
authored
Merge pull request #24744 from gaoguangze111/Update-page-cheatsheet
Update links in page cheatsheet.md
2 parents d25fe29 + e002144 commit bb60c2f

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ See also: [Kubectl Overview](/docs/reference/kubectl/overview/) and [JsonPath Gu
2424
2525
This page is an overview of the `kubectl` command.
2626
-->
27-
另见: [Kubectl 概述](/docs/reference/kubectl/overview/)[JsonPath 指南](/docs/reference/kubectl/jsonpath)
27+
另见: [Kubectl 概述](/zh/docs/reference/kubectl/overview/)[JsonPath 指南](/zh/docs/reference/kubectl/jsonpath)
2828

2929
本页面是 `kubectl` 命令的概述。
3030

@@ -85,15 +85,15 @@ detailed config file information.
8585
## Kubectl 上下文和配置
8686

8787
设置 `kubectl` 与哪个 Kubernetes 集群进行通信并修改配置信息。查看
88-
[使用 kubeconfig 跨集群授权访问](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
88+
[使用 kubeconfig 跨集群授权访问](/zh/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
8989
文档获取配置文件详细信息。
9090

91-
<!--
91+
<!--
9292
``bash
9393
kubectl config view # Show Merged kubeconfig settings.
9494
9595
# use multiple kubeconfig files at the same time and view merged config
96-
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
96+
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
9797
9898
kubectl config view
9999
@@ -102,7 +102,7 @@ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
102102
103103
kubectl config view -o jsonpath='{.users[].name}' # display the first user
104104
kubectl config view -o jsonpath='{.users[*].name}' # get a list of users
105-
kubectl config get-contexts # display list of contexts
105+
kubectl config get-contexts # display list of contexts
106106
kubectl config current-context # display the current-context
107107
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
108108
@@ -115,7 +115,7 @@ kubectl config set-context --current --namespace=ggckad-s2
115115
# set a context utilizing a specific username and namespace.
116116
kubectl config set-context gce --user=cluster-admin --namespace=foo \
117117
&& kubectl config use-context gce
118-
118+
119119
kubectl config unset users.foo # delete user foo
120120
```
121121
-->
@@ -402,7 +402,7 @@ kubectl diff -f ./my-manifest.yaml
402402
<!--
403403
```bash
404404
kubectl set image deployment/frontend www=image:v2 # Rolling update "www" containers of "frontend" deployment, updating the image
405-
kubectl rollout history deployment/frontend # Check the history of deployments including the revision
405+
kubectl rollout history deployment/frontend # Check the history of deployments including the revision
406406
kubectl rollout undo deployment/frontend # Rollback to the previous deployment
407407
kubectl rollout undo deployment/frontend --to-revision=2 # Rollback to a specific revision
408408
kubectl rollout status -w deployment/frontend # Watch rolling update status of "frontend" deployment until completion
@@ -426,7 +426,7 @@ kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a
426426
-->
427427
```bash
428428
kubectl set image deployment/frontend www=image:v2 # 滚动更新 "frontend" Deployment 的 "www" 容器镜像
429-
kubectl rollout history deployment/frontend # 检查 Deployment 的历史记录,包括版本
429+
kubectl rollout history deployment/frontend # 检查 Deployment 的历史记录,包括版本
430430
kubectl rollout undo deployment/frontend # 回滚到上次部署版本
431431
kubectl rollout undo deployment/frontend --to-revision=2 # 回滚到特定部署版本
432432
kubectl rollout status -w deployment/frontend # 监视 "frontend" Deployment 的滚动升级状态直到完成
@@ -465,13 +465,13 @@ kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/
465465
# Disable a deployment livenessProbe using a json patch with positional arrays
466466
kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/livenessProbe"}]'
467467
468-
# Add a new element to a positional array
468+
# Add a new element to a positional array
469469
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/secrets/1", "value": {"name": "whatever" } }]'
470470
```
471471
-->
472472
```bash
473473
# 部分更新某节点
474-
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
474+
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
475475

476476
# 更新容器的镜像;spec.containers[*].name 是必须的。因为它是一个合并性质的主键。
477477
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
@@ -482,7 +482,7 @@ kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/
482482
# 使用带位置数组的 JSON patch 禁用某 Deployment 的 livenessProbe
483483
kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/livenessProbe"}]'
484484

485-
# 在带位置数组中添加元素
485+
# 在带位置数组中添加元素
486486
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/secrets/1", "value": {"name": "whatever" } }]'
487487
```
488488

@@ -567,7 +567,7 @@ kubectl logs -f my-pod # stream pod logs (stdout)
567567
kubectl logs -f my-pod -c my-container # stream pod container logs (stdout, multi-container case)
568568
kubectl logs -f -l name=myLabel --all-containers # stream all pods logs with label name=myLabel (stdout)
569569
kubectl run -i --tty busybox --image=busybox -- sh # Run pod as interactive shell
570-
kubectl run nginx --image=nginx -n
570+
kubectl run nginx --image=nginx -n
571571
mynamespace # Run pod nginx in a specific namespace
572572
kubectl run nginx --image=nginx # Run pod nginx and write its spec into a file called pod.yaml
573573
--dry-run=client -o yaml > pod.yaml
@@ -641,7 +641,7 @@ kubectl taint nodes foo dedicated=special-user:NoSchedule
641641
<!--
642642
List all supported resource types along with their shortnames, [API group](/docs/concepts/overview/kubernetes-api/#api-groups), whether they are [namespaced](/docs/concepts/overview/working-with-objects/namespaces), and [Kind](/docs/concepts/overview/working-with-objects/kubernetes-objects):
643643
-->
644-
列出所支持的全部资源类型和它们的简称、[API 组](/docs/concepts/overview/kubernetes-api/#api-groups), 是否是[名字空间作用域](/docs/concepts/overview/working-with-objects/namespaces)[Kind](/docs/concepts/overview/working-with-objects/kubernetes-objects)
644+
列出所支持的全部资源类型和它们的简称、[API 组](/zh/docs/concepts/overview/kubernetes-api/#api-groups), 是否是[名字空间作用域](/zh/docs/concepts/overview/working-with-objects/namespaces)[Kind](/zh/docs/concepts/overview/working-with-objects/kubernetes-objects)
645645

646646
```bash
647647
kubectl api-resources
@@ -697,8 +697,8 @@ utput format | Description
697697
`-o=custom-columns=<spec>` | 使用逗号分隔的自定义列来打印表格
698698
`-o=custom-columns-file=<filename>` | 使用 `<filename>` 文件中的自定义列模板打印表格
699699
`-o=json` | 输出 JSON 格式的 API 对象
700-
`-o=jsonpath=<template>` | 打印 [jsonpath](/docs/reference/kubectl/jsonpath) 表达式中定义的字段
701-
`-o=jsonpath-file=<filename>` | 打印在 `<filename>` 文件中定义的 [jsonpath](/docs/reference/kubectl/jsonpath) 表达式所指定的字段。
700+
`-o=jsonpath=<template>` | 打印 [jsonpath](/zh/docs/reference/kubectl/jsonpath) 表达式中定义的字段
701+
`-o=jsonpath-file=<filename>` | 打印在 `<filename>` 文件中定义的 [jsonpath](/zh/docs/reference/kubectl/jsonpath) 表达式所指定的字段。
702702
`-o=name` | 仅打印资源名称而不打印其他内容
703703
`-o=wide` | 以纯文本格式输出额外信息,对于 Pod 来说,输出中包含了节点名称
704704
`-o=yaml` | 输出 YAML 格式的 API 对象
@@ -732,7 +732,7 @@ kubectl get pods -A -o=custom-columns='DATA:spec.containers[?(@.image!="k8s.gcr.
732732
kubectl get pods -A -o=custom-columns='DATA:metadata.*'
733733
```
734734

735-
有关更多示例,请参看 kubectl [参考文档](/docs/reference/kubectl/overview/#custom-columns)
735+
有关更多示例,请参看 kubectl [参考文档](/zh/docs/reference/kubectl/overview/#custom-columns)
736736

737737
<!--
738738
### Kubectl output verbosity and debugging
@@ -778,8 +778,7 @@ Verbosity | Description
778778
* Also [kubectl Usage Conventions](/docs/reference/kubectl/conventions/) to understand how to use it in reusable scripts.
779779
* See more community [kubectl cheatsheets](https://github.com/dennyzhang/cheatsheet-kubernetes-A4).
780780
-->
781-
* 进一步了解 [kubectl 概述](/docs/reference/kubectl/overview/)
782-
* 参阅 [kubectl](/docs/reference/kubectl/kubectl/) 选项.
783-
* 参阅 [kubectl 使用约定](/docs/reference/kubectl/conventions/)来理解如何在可复用的脚本中使用它。
781+
* 进一步了解 [kubectl 概述](/zh/docs/reference/kubectl/overview/)
782+
* 参阅 [kubectl](/zh/docs/reference/kubectl/kubectl/) 选项.
783+
* 参阅 [kubectl 使用约定](/zh/docs/reference/kubectl/conventions/)来理解如何在可复用的脚本中使用它。
784784
* 查看社区中其他的 [kubectl 备忘单](https://github.com/dennyzhang/cheatsheet-kubernetes-A4)
785-

0 commit comments

Comments
 (0)