# 打印字段选项信息
kubectl explain --help
root@k8s-master-10:~# kubectl explain pod
KIND: Pod
VERSION: v1
DESCRIPTION:
Pod is a collection of containers that can run on a host. This resource is
created by clients and scheduled onto hosts.
FIELDS:
apiVersion <string>
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind <string>
Kind is a string value representing the REST resource this object
represents. Servers may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata <ObjectMeta>
Standard object's metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec <PodSpec>
Specification of the desired behavior of the pod. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
status <PodStatus>
Most recently observed status of the pod. This data may not be up to date.
Populated by the system. Read-only. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
-----------------------------------------------------------------------------------
kubectl explain pod.spec.containers
root@k8s-master-10:~# kubectl explain pod.spec.containers
KIND: Pod
VERSION: v1
FIELD: containers <[]Container> 容器字段表示是对象列表 如下的形式
[
{},
{},
{}
]
# 列表嵌套对象,对象里面再嵌套列表
containers:
- name: 第一个容器
- name: 第二个容器
DESCRIPTION:
List of containers belonging to the pod. Containers cannot currently be
added or removed. There must be at least one container in a Pod. Cannot be
updated.
A single application container that you want to run within a pod.
FIELDS:
args <[]string> # 列表字符串,有如下两种形式显示
[1,2,3]
-1
-2
-3
Arguments to the entrypoint. The container image's CMD is used if this is
not provided. Variable references $(VAR_NAME) are expanded using the
container's environment. If a variable cannot be resolved, the reference in
the input string will be unchanged. Double $$ are reduced to a single $,
which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
produce the string literal "$(VAR_NAME)". Escaped references will never be
expanded, regardless of whether the variable exists or not. Cannot be
updated. More info:
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command <[]string> 列表字符串 ["a","b","c"]
Entrypoint array. Not executed within a shell. The container image's
ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME)
are expanded using the container's environment. If a variable cannot be
resolved, the reference in the input string will be unchanged. Double $$ are
reduced to a single $, which allows for escaping the $(VAR_NAME) syntax:
i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped
references will never be expanded, regardless of whether the variable exists
or not. Cannot be updated. More info:
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
env <[]EnvVar> 列表变量 如下表示
env:
- name: abc
value: 123
- name: sde
value: 456
List of environment variables to set in the container. Cannot be updated.
envFrom <[]EnvFromSource>
List of sources to populate environment variables in the container. The keys
defined within a source must be a C_IDENTIFIER. All invalid keys will be
reported as an event when the container is starting. When a key exists in
multiple sources, the value associated with the last source will take
precedence. Values defined by an Env with a duplicate key will take
precedence. Cannot be updated.
image <string>
Container image name. More info:
https://kubernetes.io/docs/concepts/containers/images This field is optional
to allow higher level config management to default or override container
images in workload controllers like Deployments and StatefulSets.
imagePullPolicy <string>
Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if
:latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More
info: https://kubernetes.io/docs/concepts/containers/images#updating-images
Possible enum values:
- `"Always"` means that kubelet always attempts to pull the latest image.
Container will fail If the pull fails.
- `"IfNotPresent"` means that kubelet pulls if the image isn't present on
disk. Container will fail if the image isn't present and the pull fails.
- `"Never"` means that kubelet never pulls an image, but only uses a local
image. Container will fail if the image isn't present
lifecycle <Lifecycle>
Actions that the management system should take in response to container
lifecycle events. Cannot be updated.
livenessProbe <Probe>
Periodic probe of container liveness. Container will be restarted if the
probe fails. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
name <string> -required-
Name of the container specified as a DNS_LABEL. Each container in a pod must
have a unique name (DNS_LABEL). Cannot be updated.
ports <[]ContainerPort>
List of ports to expose from the container. Not specifying a port here DOES
NOT prevent that port from being exposed. Any port which is listening on the
default "0.0.0.0" address inside a container will be accessible from the
network. Modifying this array with strategic merge patch may corrupt the
data. For more information See
https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.
readinessProbe <Probe> 就是一个纯对象
readinessProbe:
exec:
command:
- /bin/calico-node
- -felix-ready
- -bird-ready
Periodic probe of container service readiness. Container will be removed
from service endpoints if the probe fails. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
resizePolicy <[]ContainerResizePolicy>
Resources resize policy for the container.
resources <ResourceRequirements>
Compute Resources required by this container. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restartPolicy <string>
RestartPolicy defines the restart behavior of individual containers in a
pod. This field may only be set for init containers, and the only allowed
value is "Always". For non-init containers or when this field is not
specified, the restart behavior is defined by the Pod's restart policy and
the container type. Setting the RestartPolicy as "Always" for the init
container will have the following effect: this init container will be
continually restarted on exit until all regular containers have terminated.
Once all regular containers have completed, all init containers with
restartPolicy "Always" will be shut down. This lifecycle differs from normal
init containers and is often referred to as a "sidecar" container. Although
this init container still starts in the init container sequence, it does not
wait for the container to complete before proceeding to the next init
container. Instead, the next init container starts immediately after this
init container is started, or after any startupProbe has successfully
completed.
securityContext <SecurityContext>
SecurityContext defines the security options the container should be run
with. If set, the fields of SecurityContext override the equivalent fields
of PodSecurityContext. More info:
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startupProbe <Probe>
StartupProbe indicates that the Pod has successfully initialized. If
specified, no other probes are executed until this completes successfully.
If this probe fails, the Pod will be restarted, just as if the livenessProbe
failed. This can be used to provide different probe parameters at the
beginning of a Pod's lifecycle, when it might take a long time to load data
or warm a cache, than during steady-state operation. This cannot be updated.
More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
stdin <boolean>
Whether this container should allocate a buffer for stdin in the container
runtime. If this is not set, reads from stdin in the container will always
result in EOF. Default is false.
stdinOnce <boolean>
Whether the container runtime should close the stdin channel after it has
been opened by a single attach. When stdin is true the stdin stream will
remain open across multiple attach sessions. If stdinOnce is set to true,
stdin is opened on container start, is empty until the first client attaches
to stdin, and then remains open and accepts data until the client
disconnects, at which time stdin is closed and remains closed until the
container is restarted. If this flag is false, a container processes that
reads from stdin will never receive an EOF. Default is false
terminationMessagePath <string>
Optional: Path at which the file to which the container's termination
message will be written is mounted into the container's filesystem. Message
written is intended to be brief final status, such as an assertion failure
message. Will be truncated by the node if greater than 4096 bytes. The total
message length across all containers will be limited to 12kb. Defaults to
/dev/termination-log. Cannot be updated.
terminationMessagePolicy <string>
Indicate how the termination message should be populated. File will use the
contents of terminationMessagePath to populate the container status message
on both success and failure. FallbackToLogsOnError will use the last chunk
of container log output if the termination message file is empty and the
container exited with an error. The log output is limited to 2048 bytes or
80 lines, whichever is smaller. Defaults to File. Cannot be updated.
Possible enum values:
- `"FallbackToLogsOnError"` will read the most recent contents of the
container logs for the container status message when the container exits
with an error and the terminationMessagePath has no contents.
- `"File"` is the default behavior and will set the container status
message to the contents of the container's terminationMessagePath when the
container exits.
tty <boolean>
Whether this container should allocate a TTY for itself, also requires
'stdin' to be true. Default is false.
volumeDevices <[]VolumeDevice>
volumeDevices is the list of block devices to be used by the container.
volumeMounts <[]VolumeMount>
Pod volumes to mount into the container's filesystem. Cannot be updated.
workingDir <string>
Container's working directory. If not specified, the container runtime's
default will be used, which might be configured in the container image.
Cannot be updated.
root@k8s-master-10:~#
-------------------------------------------------------------------------------------
root@k8s-master-10:~# kubectl explain pod.spec.containers.ports
KIND: Pod
VERSION: v1
FIELD: ports <[]ContainerPort>
DESCRIPTION:
List of ports to expose from the container. Not specifying a port here DOES
NOT prevent that port from being exposed. Any port which is listening on the
default "0.0.0.0" address inside a container will be accessible from the
network. Modifying this array with strategic merge patch may corrupt the
data. For more information See
https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.
ContainerPort represents a network port in a single container.
FIELDS:
containerPort <integer> -required-
Number of port to expose on the pod's IP address. This must be a valid port
number, 0 < x < 65536.
hostIP <string>
What host IP to bind the external port to.
hostPort <integer>
Number of port to expose on the host. If specified, this must be a valid
port number, 0 < x < 65536. If HostNetwork is specified, this must match
ContainerPort. Most containers do not need this.
name <string>
If specified, this must be an IANA_SVC_NAME and unique within the pod. Each
named port in a pod must have a unique name. Name for the port that can be
referred to by services.
protocol <string>
Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".
Possible enum values:
- `"SCTP"` is the SCTP protocol.
- `"TCP"` is the TCP protocol.
- `"UDP"` is the UDP protocol.
root@k8s-master-10:~#
root@k8s-master-10:~# kubectl explain --help
Describe fields and structure of various resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple
JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Information about each field is retrieved from the server in OpenAPI format.
Use "kubectl api-resources" for a complete list of supported resources.
Examples:
# Get the documentation of the resource and its fields
kubectl explain pods
# Get all the fields in the resource
kubectl explain pods --recursive
# Get the explanation for deployment in supported api versions
kubectl explain deployments --api-version=apps/v1
# Get the documentation of a specific field of a resource
kubectl explain pods.spec.containers
# Get the documentation of resources in different format
kubectl explain deployment --output=plaintext-openapiv2
Options:
--api-version='':
Use given api-version (group/version) of the resource.
--output='plaintext':
Format in which to render the schema. Valid values are: (plaintext, plaintext-openapiv2).
--recursive=false:
When true, print the name of all the fields recursively. Otherwise, print the available fields with their
description.
Usage:
kubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group]
[--output=plaintext|plaintext-openapiv2] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
root@k8s-master-10:~/calico-3.27.3/manifests#
kubectl explain deployment.spec
# 关于 deployment 资源配置参数
root@k8s-master-10:~# kubectl explain deployment.spec
GROUP: apps
KIND: Deployment
VERSION: v1
FIELD: spec <DeploymentSpec>
DESCRIPTION:
Specification of the desired behavior of the Deployment.
DeploymentSpec is the specification of the desired behavior of the
Deployment.
FIELDS:
minReadySeconds <integer>
Minimum number of seconds for which a newly created pod should be ready
without any of its container crashing, for it to be considered available.
Defaults to 0 (pod will be considered available as soon as it is ready)
paused <boolean>
Indicates that the deployment is paused.
progressDeadlineSeconds <integer>
The maximum time in seconds for a deployment to make progress before it is
considered to be failed. The deployment controller will continue to process
failed deployments and a condition with a ProgressDeadlineExceeded reason
will be surfaced in the deployment status. Note that progress will not be
estimated during the time a deployment is paused. Defaults to 600s.
replicas <integer> # 定义 deployment 有几个副本
Number of desired pods. This is a pointer to distinguish between explicit
zero and not specified. Defaults to 1.
revisionHistoryLimit <integer>
The number of old ReplicaSets to retain to allow rollback. This is a pointer
to distinguish between explicit zero and not specified. Defaults to 10.
selector <LabelSelector> -required- # 定义 deployment 的标签选择器
Label selector for pods. Existing ReplicaSets whose pods are selected by
this will be the ones affected by this deployment. It must match the pod
template's labels.
strategy <DeploymentStrategy>
The deployment strategy to use to replace existing pods with new ones.
template <PodTemplateSpec> -required-
# 定义 deployment 的 template,就是定义 pod 相关的
Template describes the pods that will be created. The only allowed
template.spec.restartPolicy value is "Always".
root@k8s-master-10:~#
root@k8s-master-10:~# kubectl explain deployment.spec.template
GROUP: apps
KIND: Deployment
VERSION: v1
FIELD: template <PodTemplateSpec>
# 就是定义 pod 资源配置选项
# 因为 deployment 是管理 pod 的 就不用单独去定义 pod 直接生成
----------------------------------------------
apiVersion: v1
kind: Pod
metadata:
labels:
key: value
name: ""
namespace: ""
spec:
containers:
- image: ""
imagePullPolicy: "Always|ifNotPresent|Never"
name: ""
args: []
command: []
ports: []
env: []
resources: {}
livenessProbe: {}
readinessProbe: {}
startupProbe: {}
volumeMounts: {}
securityContext: {}
lifecycle: {}
volumes: []
----------------------------------------------
DESCRIPTION:
Template describes the pods that will be created. The only allowed
template.spec.restartPolicy value is "Always".
PodTemplateSpec describes the data a pod should have when created from a
template
FIELDS:
metadata <ObjectMeta>
Standard object's metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec <PodSpec>
Specification of the desired behavior of the pod. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
kubectl explain deployment.spec.template.spec
root@k8s-master-10:~# kubectl explain deployment.spec.template.spec
GROUP: apps
KIND: Deployment
VERSION: v1
FIELD: spec <PodSpec>
# 此时就与容器的spec 对等了
------------------------------
apiVersion: v1
kind: Pod
metadata:
labels:
key: value
name: ""
namespace: ""
spec:
containers:
- image: ""
imagePullPolicy: "Always|ifNotPresent|Never"
name: ""
args: []
command: []
ports: []
env: []
resources: {}
livenessProbe: {}
readinessProbe: {}
startupProbe: {}
volumeMounts: {}
securityContext: {}
lifecycle: {}
volumes: []
------------------------------
# 因为 deployment 管理 pod ,所以deployment与pod的 containers 字段是一模一样的
root@k8s-master-10:~# kubectl explain deployment.spec.template.spec.containers
root@k8s-master-10:~# kubectl explain deployment.spec.template.spec.containers
GROUP: apps
KIND: Deployment
VERSION: v1
FIELD: containers <[]Container>
DESCRIPTION:
List of containers belonging to the pod. Containers cannot currently be
added or removed. There must be at least one container in a Pod. Cannot be
updated.
A single application container that you want to run within a pod.
FIELDS:
args <[]string>
Arguments to the entrypoint. The container image's CMD is used if this is
not provided. Variable references $(VAR_NAME) are expanded using the
container's environment. If a variable cannot be resolved, the reference in
the input string will be unchanged. Double $$ are reduced to a single $,
which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
produce the string literal "$(VAR_NAME)". Escaped references will never be
expanded, regardless of whether the variable exists or not. Cannot be
updated. More info:
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
command <[]string>
Entrypoint array. Not executed within a shell. The container image's
ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME)
are expanded using the container's environment. If a variable cannot be
resolved, the reference in the input string will be unchanged. Double $$ are
reduced to a single $, which allows for escaping the $(VAR_NAME) syntax:
i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped
references will never be expanded, regardless of whether the variable exists
or not. Cannot be updated. More info:
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
env <[]EnvVar>
List of environment variables to set in the container. Cannot be updated.
envFrom <[]EnvFromSource>
List of sources to populate environment variables in the container. The keys
defined within a source must be a C_IDENTIFIER. All invalid keys will be
reported as an event when the container is starting. When a key exists in
multiple sources, the value associated with the last source will take
precedence. Values defined by an Env with a duplicate key will take
precedence. Cannot be updated.
image <string>
Container image name. More info:
https://kubernetes.io/docs/concepts/containers/images This field is optional
to allow higher level config management to default or override container
images in workload controllers like Deployments and StatefulSets.
imagePullPolicy <string>
Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if
:latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More
info: https://kubernetes.io/docs/concepts/containers/images#updating-images
Possible enum values:
- `"Always"` means that kubelet always attempts to pull the latest image.
Container will fail If the pull fails.
- `"IfNotPresent"` means that kubelet pulls if the image isn't present on
disk. Container will fail if the image isn't present and the pull fails.
- `"Never"` means that kubelet never pulls an image, but only uses a local
image. Container will fail if the image isn't present
lifecycle <Lifecycle>
Actions that the management system should take in response to container
lifecycle events. Cannot be updated.
livenessProbe <Probe>
Periodic probe of container liveness. Container will be restarted if the
probe fails. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
name <string> -required-
Name of the container specified as a DNS_LABEL. Each container in a pod must
have a unique name (DNS_LABEL). Cannot be updated.
ports <[]ContainerPort>
List of ports to expose from the container. Not specifying a port here DOES
NOT prevent that port from being exposed. Any port which is listening on the
default "0.0.0.0" address inside a container will be accessible from the
network. Modifying this array with strategic merge patch may corrupt the
data. For more information See
https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.
readinessProbe <Probe>
Periodic probe of container service readiness. Container will be removed
from service endpoints if the probe fails. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
resizePolicy <[]ContainerResizePolicy>
Resources resize policy for the container.
resources <ResourceRequirements>
Compute Resources required by this container. Cannot be updated. More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
restartPolicy <string>
RestartPolicy defines the restart behavior of individual containers in a
pod. This field may only be set for init containers, and the only allowed
value is "Always". For non-init containers or when this field is not
specified, the restart behavior is defined by the Pod's restart policy and
the container type. Setting the RestartPolicy as "Always" for the init
container will have the following effect: this init container will be
continually restarted on exit until all regular containers have terminated.
Once all regular containers have completed, all init containers with
restartPolicy "Always" will be shut down. This lifecycle differs from normal
init containers and is often referred to as a "sidecar" container. Although
this init container still starts in the init container sequence, it does not
wait for the container to complete before proceeding to the next init
container. Instead, the next init container starts immediately after this
init container is started, or after any startupProbe has successfully
completed.
securityContext <SecurityContext>
SecurityContext defines the security options the container should be run
with. If set, the fields of SecurityContext override the equivalent fields
of PodSecurityContext. More info:
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
startupProbe <Probe>
StartupProbe indicates that the Pod has successfully initialized. If
specified, no other probes are executed until this completes successfully.
If this probe fails, the Pod will be restarted, just as if the livenessProbe
failed. This can be used to provide different probe parameters at the
beginning of a Pod's lifecycle, when it might take a long time to load data
or warm a cache, than during steady-state operation. This cannot be updated.
More info:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
stdin <boolean>
Whether this container should allocate a buffer for stdin in the container
runtime. If this is not set, reads from stdin in the container will always
result in EOF. Default is false.
stdinOnce <boolean>
Whether the container runtime should close the stdin channel after it has
been opened by a single attach. When stdin is true the stdin stream will
remain open across multiple attach sessions. If stdinOnce is set to true,
stdin is opened on container start, is empty until the first client attaches
to stdin, and then remains open and accepts data until the client
disconnects, at which time stdin is closed and remains closed until the
container is restarted. If this flag is false, a container processes that
reads from stdin will never receive an EOF. Default is false
terminationMessagePath <string>
Optional: Path at which the file to which the container's termination
message will be written is mounted into the container's filesystem. Message
written is intended to be brief final status, such as an assertion failure
message. Will be truncated by the node if greater than 4096 bytes. The total
message length across all containers will be limited to 12kb. Defaults to
/dev/termination-log. Cannot be updated.
terminationMessagePolicy <string>
Indicate how the termination message should be populated. File will use the
contents of terminationMessagePath to populate the container status message
on both success and failure. FallbackToLogsOnError will use the last chunk
of container log output if the termination message file is empty and the
container exited with an error. The log output is limited to 2048 bytes or
80 lines, whichever is smaller. Defaults to File. Cannot be updated.
Possible enum values:
- `"FallbackToLogsOnError"` will read the most recent contents of the
container logs for the container status message when the container exits
with an error and the terminationMessagePath has no contents.
- `"File"` is the default behavior and will set the container status
message to the contents of the container's terminationMessagePath when the
container exits.
tty <boolean>
Whether this container should allocate a TTY for itself, also requires
'stdin' to be true. Default is false.
volumeDevices <[]VolumeDevice>
volumeDevices is the list of block devices to be used by the container.
volumeMounts <[]VolumeMount>
Pod volumes to mount into the container's filesystem. Cannot be updated.
workingDir <string>
Container's working directory. If not specified, the container runtime's
default will be used, which might be configured in the container image.
Cannot be updated.
root@k8s-master-10:~#
如何查看参数?如何使用 help?
kubectl create deployment --help
root@k8s-master-10:~# kubectl create deployment --help
Create a deployment with the specified name.
Aliases:
deployment, deploy
Examples:
# Create a deployment named my-dep that runs the busybox image
kubectl create deployment my-dep --image=busybox
# Create a deployment with a command
kubectl create deployment my-dep --image=busybox -- date
# Create a deployment named my-dep that runs the nginx image with 3 replicas
kubectl create deployment my-dep --image=nginx --replicas=3
# Create a deployment named my-dep that runs the busybox image and expose port 5701
kubectl create deployment my-dep --image=busybox --port=5701
Options:
--allow-missing-template-keys=true:
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to
golang and jsonpath output formats.
--dry-run='none':
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without
sending it. If server strategy, submit server-side request without persisting the resource.
--field-manager='kubectl-create':
Name of the manager used to track field ownership.
--image=[]:
Image names to run.
-o, --output='':
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath,
jsonpath-as-json, jsonpath-file).
--port=-1:
The port that this container exposes.
-r, --replicas=1:
Number of replicas to create. Default is 1.
--save-config=false:
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will
be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--show-managed-fields=false:
If true, keep the managedFields when printing objects in JSON or YAML format.
--template='':
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format
is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate='strict':
Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema to validate
the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation
is enabled on the api-server, but will fall back to less reliable client-side validation if not. "warn" will
warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled
on the API server, and behave as "ignore" otherwise. "false" or "ignore" will not perform any schema
validation, silently dropping any unknown or duplicate fields.
Usage:
kubectl create deployment NAME --image=image -- [COMMAND] [args...] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
root@k8s-master-10:~#
如何快速获取所需的 YAML 文件
dry-run 可以快速获取所需的 YAML 文件