You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zh/docs/reference/kubectl/conventions.md
+47-74Lines changed: 47 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ content_type: concept
18
18
<!--
19
19
Recommended usage conventions for `kubectl`.
20
20
-->
21
-
`kubectl` 的推荐用法约定
21
+
`kubectl` 的推荐用法约定。
22
22
23
23
24
24
<!-- body -->
@@ -36,13 +36,11 @@ For a stable output in a script:
36
36
<!--
37
37
* Request one of the machine-oriented output forms, such as `-o name`, `-o json`, `-o yaml`, `-o go-template`, or `-o jsonpath`.
38
38
* Fully-qualify the version. For example, `jobs.v1.batch/myjob`. This will ensure that kubectl does not use its default version that can change over time.
39
-
* Specify the `--generator` flag to pin to a specific behavior when you use generator-based commands such as `kubectl run` or `kubectl expose`.
40
39
* Don't rely on context, preferences, or other implicit states.
@@ -59,99 +57,74 @@ For `kubectl run` to satisfy infrastructure as code:
59
57
60
58
<!--
61
59
* Tag the image with a version-specific tag and don't move that tag to a new version. For example, use `:v1234`, `v1.2.3`, `r03062016-1-4`, rather than `:latest` (For more information, see [Best Practices for Configuration](/docs/concepts/configuration/overview/#container-images)).
62
-
* Capture the parameters in a checked-in script, or at least use `--record` to annotate the created objects with the command line for an image that is lightly parameterized.
63
-
* Pin to a specific [generator](#generators) version, such as `kubectl run --generator=run-pod/v1`.
64
60
* Check in the script for an image that is heavily parameterized.
65
61
* Switch to configuration files checked into source control for features that are needed, but not expressible via `kubectl run` flags.
| ReplicationController _(已弃用)_| v1 |`kubectl run --generator=run/v1`|
102
-
| Deployment _(已弃用)_| extensions/v1beta1 |`kubectl run --generator=deployment/v1beta1`|
103
-
| Deployment _(已弃用)_| apps/v1beta1 |`kubectl run --generator=deployment/apps.v1beta1`|
104
-
| Job _(已弃用)_| batch/v1 |`kubectl run --generator=job/v1`|
105
-
| CronJob _(已弃用)_| batch/v2alpha1 |`kubectl run --generator=cronjob/v2alpha1`|
106
-
| CronJob _(已弃用)_| batch/v1beta1 |`kubectl run --generator=cronjob/v1beta1`|
107
-
{{< /table >}}
71
+
你可以使用 `--dry-run=client` 参数来预览而不真正提交即将下发到集群的对象实例:
108
72
109
73
{{< note >}}
110
-
<!--Generators other than `run-pod/v1` are deprecated.-->
111
-
不推荐使用 `run-pod/v1` 以外的其他生成器.
112
-
{{< /note >}}
113
-
114
74
<!--
115
-
If you explicitly set `--generator`, kubectl uses the generator you specified. If you invoke `kubectl run` and don't specify a generator, kubectl automatically selects which generator to use based on the other flags you set. The following table lists flags and the generators that are activated if you didn't specify one yourself:
75
+
All `kubectl run` generators are deprecated.
76
+
See the Kubernetes v1.17 documentation for a [list](https://v1-17.docs.kubernetes.io/docs/reference/kubectl/conventions/#generators) of generators and how they were used.
* You can use `kubectl apply` to create or update resources. For more information about using kubectl apply to update resources, see [Kubectl Book](https://kubectl.docs.kubernetes.io).
0 commit comments