Command Line Tool (Kubectl)
Command Line Tool (Kubectl)
Kubernetes provides a command line tool for communicating with a Kubernetes cluster's
control plane,
using the Kubernetes API.
For configuration, kubectl looks for a file named config in the $HOME/.kube directory.
You
can specify other kubeconfig
files by setting the KUBECONFIG environment variable or by
setting the
--kubeconfig flag.
This overview covers kubectl syntax, describes the command operations, and provides
common examples.
For details about each command, including all the supported flags and
subcommands, see the
kubectl reference documentation.
Syntax
Use the following syntax to run kubectl commands from your terminal window:
command : Specifies the operation that you want to perform on one or more resources,
for example create , get , describe , delete .
TYPE : Specifies the resource type. Resource types are case-insensitive and
you can
specify the singular, plural, or abbreviated forms.
For example, the following commands
produce the same output:
NAME : Specifies the name of the resource. Names are case-sensitive. If the name is
omitted, details for all resources are displayed, for example kubectl get pods .
When performing an operation on multiple resources, you can specify each resource by
type and name or specify one or more files:
To group resources if they are all the same type: TYPE1 name1 name2 name<#> .
https://kubernetes.io/docs/reference/kubectl/_print/ 1/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Use YAML rather than JSON since YAML tends to be more user-friendly,
especially for configuration files.
Caution: Flags that you specify from the command line override default values and any
corresponding environment variables.
If you need help, run kubectl help from the terminal window.
If the POD_NAMESPACE environment variable is set, cli operations on namespaced resources will
default to the variable value. For example, if the variable is set to seattle , kubectl get pods
would return pods in the seattle namespace. This is because pods are a namespaced
resource, and no namespace was provided in the command. Review the output of kubectl
api-resources to determine if a resource is namespaced.
If:
then kubectl assumes it is running in your cluster. The kubectl tool looks up the
namespace of
that ServiceAccount (this is the same as the namespace of the Pod)
and acts against that
namespace. This is different from what happens outside of a
cluster; when kubectl runs
outside a cluster and you don't specify a namespace,
the kubectl command acts against the
namespace set for the current context in your
client configuration. To change the default
namespace for your kubectl you can use the
following command:
Operations
https://kubernetes.io/docs/reference/kubectl/_print/ 2/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
The following table includes short descriptions and the general syntax for all of the kubectl
operations:
https://kubernetes.io/docs/reference/kubectl/_print/ 3/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
https://kubernetes.io/docs/reference/kubectl/_print/ 4/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Resource types
The following table includes a list of all the supported resource types and their abbreviated
aliases.
(This output can be retrieved from kubectl api-resources , and was accurate as of Kubernetes
1.25.0)
https://kubernetes.io/docs/reference/kubectl/_print/ 5/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
https://kubernetes.io/docs/reference/kubectl/_print/ 6/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
https://kubernetes.io/docs/reference/kubectl/_print/ 7/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Output options
Use the following sections for information about how you can format or sort the output of
certain commands. For details about which commands support the various output options,
see the kubectl reference documentation.
Formatting output
The default output format for all kubectl commands is the human readable plain-text
format. To output details to your terminal window in a specific format, you can add either the
-o or --output flags to a supported kubectl command.
Syntax
Depending on the kubectl operation, the following output formats are supported:
Custom columns
To define custom columns and output only the details that you want into a table, you can use
the custom-columns option.
You can choose to define the custom columns inline or use a
template file: -o custom-columns=<spec> or -o custom-columns-file=<filename> .
Examples
Inline:
https://kubernetes.io/docs/reference/kubectl/_print/ 9/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Template file:
NAME RSRC
metadata.name metadata.resourceVersion
NAME RSRC
submit-queue 610995
Server-side columns
kubectl supports receiving specific column information from the server about objects.
This
means that for any given resource, the server will return columns and rows relevant to that
resource, for the client to print.
This allows for consistent human-readable output across
clients used against the same cluster, by having the server encapsulate the details of printing.
Examples
To print information about the status of a pod, use a command like the following:
NAME AGE
pod-name 1m
Syntax
Example
To print a list of pods sorted by name, you run:
https://kubernetes.io/docs/reference/kubectl/_print/ 10/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
# Create the objects that are defined in any .yaml, .yml, or .json file within the <direc
kubectl apply -f <directory>
# List all pods in plain-text output format and include additional information (such as n
kubectl get pods -o wide
# List the replication controller with the specified name in plain-text output format. Ti
kubectl get replicationcontroller <rc-name>
# List all replication controllers and services together in plain-text output format.
kubectl get ds
kubectl describe - Display detailed state of one or more resources, including the uninitialized
ones by default.
# Display the details of all the pods that are managed by the replication controller name
# Remember: Any pods that are created by the replication controller get prefixed with the
kubectl describe pods <rc-name>
Note: The kubectl get command is usually used for retrieving one or more
resources of
the same resource type. It features a rich set of flags that allows
you to customize the
output format using the -o or --output flag, for example.
You can specify the -w or --watch
flag to start watching updates to a particular
object. The kubectl describe command is
more focused on describing the many
related aspects of a specified resource. It may
invoke several API calls to the
API server to build a view for the user. For example, the
https://kubernetes.io/docs/reference/kubectl/_print/ 11/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
kubectl delete - Delete resources either from a file, stdin, or specifying label selectors,
names, resource selectors, or resources.
# Delete a pod using the type and name specified in the pod.yaml file.
# Delete all the pods and services that have the label '<label-key>=<label-value>'.
# Get output from running 'date' from pod <pod-name>. By default, output is from the firs
kubectl exec <pod-name> -- date
# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is fro
kubectl exec -ti <pod-name> -- /bin/bash
# Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux co
kubectl logs -f <pod-name>
# create a simple plugin in any language and name the resulting executable file
cat ./kubectl-hello
#!/bin/sh
https://kubernetes.io/docs/reference/kubectl/_print/ 12/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
# You can begin using this plugin by invoking it from kubectl as if it were a regular com
kubectl hello
hello world
sudo rm /usr/local/bin/kubectl-hello
In order to view all of the plugins that are available to kubectl , use
the kubectl plugin list
subcommand:
/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
/usr/local/bin/kubectl-bar
kubectl plugin list also warns you about plugins that are not
executable, or that are
shadowed by other plugins; for example:
/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
/usr/local/bin/kubectl-bar
You can think of plugins as a means to build more complex functionality on top
of the existing
kubectl commands:
https://kubernetes.io/docs/reference/kubectl/_print/ 13/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
cat ./kubectl-whoami
The next few examples assume that you already made kubectl-whoami have
the following
contents:
#!/bin/bash
# this plugin makes use of the `kubectl config` command in order to output
# information about the current user, based on the currently selected context
kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config cu
Running the above command gives you an output containing the user for the
current context
in your KUBECONFIG file:
kubectl whoami
What's next
Read the kubectl reference documentation:
the kubectl command reference
the command line arguments reference
Learn about kubectl usage conventions
Read about JSONPath support in kubectl
Read about how to extend kubectl with plugins
To find out more about plugins, take a look at the example CLI plugin.
https://kubernetes.io/docs/reference/kubectl/_print/ 14/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Kubectl autocomplete
BASH
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, ba
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to y
You can also use a shorthand alias for kubectl that also works with completion:
alias k=kubectl
ZSH
source <(kubectl completion zsh) # setup autocomplete in zsh into the current shell
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add aut
A Note on --all-namespaces
Appending --all-namespaces happens frequently enough where you should be aware of the
shorthand for --all-namespaces :
kubectl -A
# use multiple kubeconfig files at the same time and view merged config
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
# configure the URL to a proxy server to use for requests made by this client in the k
https://kubernetes.io/docs/reference/kubectl/_print/ 15/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
# permanently save the namespace for all subsequent kubectl commands in that context.
# short alias to set/show context/namespace (only works for bash and bash-compatible s
alias kx='f() { [ "$1" ] && kubectl config use-context $1 || kubectl config current-co
alias kn='f() { [ "$1" ] && kubectl config set-context --current --namespace $1 || kub
Kubectl apply
apply manages applications through files defining Kubernetes resources. It creates and
updates resources in a cluster through running kubectl apply . This is the recommended way
of managing Kubernetes applications on production. See Kubectl Book.
Creating objects
Kubernetes manifests can be defined in YAML or JSON. The file extension .yaml ,
.yml , and
.json can be used.
apiVersion: v1
kind: Pod
metadata:
name: busybox-sleep
spec:
containers:
- name: busybox
image: busybox:1.28
args:
- sleep
- "1000000"
---
apiVersion: v1
kind: Pod
metadata:
name: busybox-sleep-less
spec:
containers:
- name: busybox
https://kubernetes.io/docs/reference/kubectl/_print/ 16/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
image: busybox:1.28
args:
- sleep
- "1000"
EOF
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
EOF
kubectl get pods -o wide # List all pods in the current namespace, w
kubectl get deployment my-dep # List a particular deployment
jsonpath='{.items[*].metadata.labels.version}'
-o jsonpath='{.data.ca\.crt}'
# Get all worker nodes (use a selector to exclude results that have a label
# named 'node-role.kubernetes.io/control-plane')
# "jq" command useful for transformations that are too complex for jsonpath, it can be fo
sel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries | .[] |
echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})
https://kubernetes.io/docs/reference/kubectl/_print/ 17/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
# Show labels for all pods (or any other Kubernetes object that supports labelling)
# Compares the current state of the cluster against the state that the cluster would be i
kubectl diff -f ./my-manifest.yaml
# Produce ENV for all pods, assuming you have a default container for the pods, default n
# Helpful when running any supported command across all pods, not just `env`
Updating resources
# Force replace, delete and then re-create the resource. Will cause a service outage.
# Create a service for a replicated nginx, which serves on port 80 and connects to the co
kubectl expose rc nginx --port=80 --target-port=8000
kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace
https://kubernetes.io/docs/reference/kubectl/_print/ 18/39
10/31/22, 3:29 PM Command line tool (kubectl) | Kubernetes
Patching resources
kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "path": "/
Editing resources
Edit any API resource in your preferred editor.
Scaling resources
Deleting resources
kubectl logs my-pod --previous # dump pod logs (stdout) for a pre
kubectl logs my-pod -c my-container # dump pod container logs (stdout,
kubectl logs -l name=myLabel -c my-container # dump pod logs, with label name=m
kubectl logs my-pod -c my-container --previous # dump pod container logs (stdout,
kubectl logs -f my-pod # stream pod logs (stdout)
Note: kubectl cp requires that the 'tar' binary is present in your container image. If 'tar' is
not present,kubectl cp will fail.
For advanced use cases, such as symlinks, wildcard
expansion or file mode preservation consider using kubectl exec.
https://kubernetes.io/docs/reference/kubectl/_print/ 20/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
# If a taint with that key and effect already exists, its value is replaced as specifi
kubectl taint nodes foo dedicated=special-user:NoSchedule
Resource types
List all supported resource types along with their shortnames, API group, whether they are
namespaced, and Kind:
kubectl api-resources
kubectl api-resources -o name # All resources with simple output (only the
kubectl api-resources -o wide # All resources with expanded (aka "wide") o
kubectl api-resources --verbs=list,get # All resources that support the "list" and
kubectl api-resources --api-group=extensions # All resources in the "extensions" API grou
Formatting output
To output details to your terminal window in a specific format, add the -o (or --output ) flag
to a supported kubectl command.
Verbosity Description
--v=2 Useful steady state information about the service and important log
messages that may correlate to significant changes in the system. This is the
recommended default log level for most systems.
What's next
Read the kubectl overview and learn about JsonPath.
Also read kubectl Usage Conventions to understand how to use kubectl in reusable
scripts.
https://kubernetes.io/docs/reference/kubectl/_print/ 22/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
2 - kubectl Commands
kubectl Command Reference
https://kubernetes.io/docs/reference/kubectl/_print/ 23/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
3 - kubectl
Synopsis
kubectl controls the Kubernetes cluster manager.
kubectl [flags]
Options
--add-dir-header
If true, adds the file directory to the header of the log messages
--alsologtostderr
--as string
--as-group stringArray
Group to impersonate for the operation, this flag can be repeated to specify multiple
groups.
--azure-container-registry-config string
--certificate-authority string
--client-certificate string
--client-key string
CIDRs opened in GCE firewall for L7 LB traffic proxy & health checks
--cloud-provider-gce-lb-src-cidrs cidrs Default:
130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks
https://kubernetes.io/docs/reference/kubectl/_print/ 24/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
--cluster string
--context string
-h, --help
--insecure-skip-tls-verify
If true, the server's certificate will not be checked for validity. This will make your HTTPS
connections insecure
--kubeconfig string
--log-backtrace-at traceLocation Default: :0
--log-dir string
--log-file string
Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the
maximum file size is unlimited.
--log-flush-frequency duration Default: 5s
--logtostderr Default: true
--match-server-version
https://kubernetes.io/docs/reference/kubectl/_print/ 25/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
--one-output
If true, only write logs to their native severity level (vs also writing to each lower severity
level
--password string
The length of time to wait before giving up on a single server request. Non-zero values
should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't
timeout requests.
--skip-headers
--skip-log-headers
--stderrthreshold severity Default: 2
--tls-server-name string
Server name to use for server certificate validation. If it is not provided, the hostname
used to contact the server is used
--token string
--user string
--username string
--version version[=true]
https://kubernetes.io/docs/reference/kubectl/_print/ 26/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
--vmodule moduleSpec
--warnings-as-errors
Treat warnings received from the server as errors and exit with a non-zero exit code
Environment variables
KUBECONFIG
KUBECTL_COMMAND_HEADERS
When set to false, turns off extra HTTP headers detailing invoked kubectl command
(Kubernetes version v1.22 or later)
See Also
kubectl annotate - Update the annotations on a resource
kubectl api-resources - Print the supported API resources on the server
kubectl api-versions - Print the supported API versions on the server, in the form of
"group/version"
kubectl apply - Apply a configuration to a resource by filename or stdin
kubectl attach - Attach to a running container
kubectl auth - Inspect authorization
kubectl autoscale - Auto-scale a Deployment, ReplicaSet, or ReplicationController
kubectl certificate - Modify certificate resources.
kubectl cluster-info - Display cluster info
kubectl completion - Output shell completion code for the specified shell (bash or zsh)
kubectl config - Modify kubeconfig files
kubectl cordon - Mark node as unschedulable
kubectl cp - Copy files and directories to and from containers.
kubectl create - Create a resource from a file or from stdin.
kubectl debug - Create debugging sessions for troubleshooting workloads and nodes
kubectl delete - Delete resources by filenames, stdin, resources and names, or by
resources and label selector
kubectl describe - Show details of a specific resource or group of resources
kubectl diff - Diff live version against would-be applied version
kubectl drain - Drain node in preparation for maintenance
kubectl edit - Edit a resource on the server
kubectl exec - Execute a command in a container
kubectl explain - Documentation of resources
kubectl expose - Take a replication controller, service, deployment or pod and expose it
as a new Kubernetes Service
kubectl get - Display one or many resources
kubectl kustomize - Build a kustomization target from a directory or a remote url.
kubectl label - Update the labels on a resource
kubectl logs - Print the logs for a container in a pod
kubectl options - Print the list of flags inherited by all commands
https://kubernetes.io/docs/reference/kubectl/_print/ 27/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
https://kubernetes.io/docs/reference/kubectl/_print/ 28/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
4 - JSONPath Support
Kubectl supports JSONPath template.
Note:
The $ operator is optional since the expression always starts from the root object
by default.
"kind": "List",
"items":[
"kind":"None",
"metadata":{"name":"127.0.0.1"},
"status":{
"capacity":{"cpu":"4"},
},
"kind":"None",
"metadata":{"name":"127.0.0.2"},
"status":{
"capacity":{"cpu":"8"},
"addresses":[
],
"users":[
"name": "myself",
"user": {}
},
"name": "e2e",
https://kubernetes.io/docs/reference/kubectl/_print/ 29/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
Note:
On Windows, you must double quote any JSONPath template that contains spaces (not
single quote as shown above for bash). This in turn means that you must use a single
quote or escaped double quote around any literals in the template. For example:
https://kubernetes.io/docs/reference/kubectl/_print/ 30/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
Note:
JSONPath regular expressions are not supported. If you want to match using regular
expressions, you can use a tool such as jq .
https://kubernetes.io/docs/reference/kubectl/_print/ 31/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
docker run
To run an nginx Deployment and expose the Deployment, see kubectl create deployment.
docker:
55c103fa129692154a7652490236fee9be47d70a8dd562281ae7d2f9a339a6db
docker ps
kubectl:
deployment.apps/nginx-app created
Note: kubectl commands print the type and name of the resource created or mutated,
which can then be used in subsequent commands. You can expose a new Service after a
Deployment is created.
https://kubernetes.io/docs/reference/kubectl/_print/ 32/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
By using kubectl, you can create a Deployment to ensure that N pods are running nginx,
where N is the number of replicas stated in the spec and defaults to 1. You can also create a
service with a selector that matches the pod labels. For more information, see Use a Service
to Access an Application in a Cluster.
By default images run in the background, similar to docker run -d ... . To run things in the
foreground, use kubectl run to create pod:
Unlike docker run ... , if you specify --attach , then you attach stdin , stdout and stderr .
You cannot control which streams are attached ( docker -a ... ).
To detach from the
container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.
docker ps
To list what is currently running, see kubectl get.
docker:
docker ps -a
kubectl:
kubectl get po
docker attach
To attach a process that is already running in a container, see kubectl attach.
docker:
docker ps
...
https://kubernetes.io/docs/reference/kubectl/_print/ 33/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
kubectl:
...
To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.
docker exec
To execute a command in a container, see kubectl exec.
docker:
docker ps
55c103fa1296
kubectl:
kubectl get po
nginx-app-5jyvm
docker:
https://kubernetes.io/docs/reference/kubectl/_print/ 34/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
# exit
kubectl:
# exit
docker logs
To follow stdout/stderr of a process that is running, see kubectl logs.
docker:
192.168.9.1 - - [14/Jul/2015:01:04:02 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.35.0" "
192.168.9.1 - - [14/Jul/2015:01:04:03 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.35.0" "
kubectl:
There is a slight difference between pods and containers; by default pods do not terminate if
their processes exit. Instead the pods restart the process. This is similar to the docker run
option --restart=always with one major difference. In docker, the output for each invocation
of the process is concatenated, but for Kubernetes, each invocation is separate. To see the
output from a previous run in Kubernetes, do this:
docker:
https://kubernetes.io/docs/reference/kubectl/_print/ 35/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
docker ps
a9ec34d98787
docker rm a9ec34d98787
a9ec34d98787
kubectl:
nginx-app 1/1 1 1 2m
# Return nothing
Note: When you use kubectl, you don't delete the pod directly. You have to first delete
the Deployment that owns the pod. If you delete the pod directly, the Deployment
recreates the pod.
docker login
https://kubernetes.io/docs/reference/kubectl/_print/ 36/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes
with a private registry, see Using a Private Registry.
docker version
To get the version of client and server, see kubectl version.
docker:
docker version
kubectl:
kubectl version
docker info
To get miscellaneous information about the environment and configuration, see kubectl
cluster-info.
docker:
docker info
https://kubernetes.io/docs/reference/kubectl/_print/ 37/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
Containers: 40
Images: 168
Dirs: 248
CPUs: 12
Name: k8s-is-fun.mtv.corp.google.com
ID: ADUV:GCYR:B3VJ:HMPO:LNPQ:KD5S:YKFQ:76VN:IANZ:7TFV:ZBF4:BYJO
kubectl:
kubectl cluster-info
https://kubernetes.io/docs/reference/kubectl/_print/ 38/39
10/31/22, 3:30 PM Command line tool (kubectl) | Kubernetes
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.
Don't rely on context, preferences, or other implicit states.
Subresources
You can use the --subresource alpha flag for kubectl commands like get , patch ,
edit
and replace to fetch and update subresources for all resources that
support them.
Currently, only the status and scale subresources are supported.
The API contract against a subresource is identical to a full resource. While updating the
status subresource to a new value, keep in mind that the subresource could be
potentially
reconciled by a controller to a different value.
Best Practices
kubectl run
For kubectl run to satisfy infrastructure as code:
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).
Check in the script for an image that is heavily parameterized.
Switch to configuration files checked into source control for features that are needed,
but not expressible via kubectl run flags.
You can use the --dry-run=client flag to preview the object that would be sent to your
cluster, without really submitting it.
kubectl apply
You can use kubectl apply to create or update resources. For more information about
using kubectl apply to update resources, see Kubectl Book.
https://kubernetes.io/docs/reference/kubectl/_print/ 39/39