website/docs/user-guide/kubectl/v1.5/index.html

5734 lines
235 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Kubectl Reference Docs</title>
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.min.css" type="text/css">
<link rel="stylesheet" href="node_modules/highlight.js/styles/default.css" type="text/css">
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>
<body>
<div id="sidebar-wrapper" class="side-nav side-bar-nav"><ul><li class="nav-level-1 strong-nav"><a href="#-strong-getting-started-strong-" class="nav-item"><strong>GETTING STARTED</strong></a></li></ul><ul><li class="nav-level-1"><a href="#run" class="nav-item">run</a></li></ul><ul><li class="nav-level-1"><a href="#expose" class="nav-item">expose</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-app-management-strong-" class="nav-item"><strong>APP MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#annotate" class="nav-item">annotate</a></li></ul><ul><li class="nav-level-1"><a href="#autoscale" class="nav-item">autoscale</a></li></ul><ul><li class="nav-level-1"><a href="#convert" class="nav-item">convert</a></li></ul><ul><li class="nav-level-1"><a href="#create" class="nav-item">create</a></li><ul id="create-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-configmap-em-" class="nav-item"><em>configmap</em></a></li><li class="nav-level-2"><a href="#-em-deployment-em-" class="nav-item"><em>deployment</em></a></li><li class="nav-level-2"><a href="#-em-namespace-em-" class="nav-item"><em>namespace</em></a></li><li class="nav-level-2"><a href="#-em-quota-em-" class="nav-item"><em>quota</em></a></li><li class="nav-level-2"><a href="#-em-secret-em-" class="nav-item"><em>secret</em></a></li><li class="nav-level-2"><a href="#-em-secret-docker-registry-em-" class="nav-item"><em>secret docker-registry</em></a></li><li class="nav-level-2"><a href="#-em-secret-generic-em-" class="nav-item"><em>secret generic</em></a></li><li class="nav-level-2"><a href="#-em-secret-tls-em-" class="nav-item"><em>secret tls</em></a></li><li class="nav-level-2"><a href="#-em-service-em-" class="nav-item"><em>service</em></a></li><li class="nav-level-2"><a href="#-em-service-clusterip-em-" class="nav-item"><em>service clusterip</em></a></li><li class="nav-level-2"><a href="#-em-service-loadbalancer-em-" class="nav-item"><em>service loadbalancer</em></a></li><li class="nav-level-2"><a href="#-em-service-nodeport-em-" class="nav-item"><em>service nodeport</em></a></li><li class="nav-level-2"><a href="#-em-serviceaccount-em-" class="nav-item"><em>serviceaccount</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#delete" class="nav-item">delete</a></li></ul><ul><li class="nav-level-1"><a href="#edit" class="nav-item">edit</a></li></ul><ul><li class="nav-level-1"><a href="#get" class="nav-item">get</a></li></ul><ul><li class="nav-level-1"><a href="#label" class="nav-item">label</a></li></ul><ul><li class="nav-level-1"><a href="#patch" class="nav-item">patch</a></li></ul><ul><li class="nav-level-1"><a href="#replace" class="nav-item">replace</a></li></ul><ul><li class="nav-level-1"><a href="#rolling-update" class="nav-item">rolling-update</a></li></ul><ul><li class="nav-level-1"><a href="#rollout" class="nav-item">rollout</a></li><ul id="rollout-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-history-em-" class="nav-item"><em>history</em></a></li><li class="nav-level-2"><a href="#-em-pause-em-" class="nav-item"><em>pause</em></a></li><li class="nav-level-2"><a href="#-em-resume-em-" class="nav-item"><em>resume</em></a></li><li class="nav-level-2"><a href="#-em-status-em-" class="nav-item"><em>status</em></a></li><li class="nav-level-2"><a href="#-em-undo-em-" class="nav-item"><em>undo</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#scale" class="nav-item">scale</a></li></ul><ul><li class="nav-level-1"><a href="#set" class="nav-item">set</a></li><ul id="set-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-image-em-" class="nav-item"><em>image</em></a></li><li class="nav-level-2"><a href="#-em-resources-em-" class="nav-item"><em>resources</em></a></li></ul></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-declarative-app-management-strong-" class="nav-item"><strong>DECLARATIVE APP MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#apply" class="nav-item">apply</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-working-with-apps-strong-" class="nav-item"><strong>WORKING WITH APPS</strong></a></li></ul><ul><li class="nav-level-1"><a href="#attach" class="nav-item">attach</a></li></ul><ul><li class="nav-level-1"><a href="#cp" class="nav-item">cp</a></li></ul><ul><li class="nav-level-1"><a href="#describe" class="nav-item">describe</a></li></ul><ul><li class="nav-level-1"><a href="#exec" class="nav-item">exec</a></li></ul><ul><li class="nav-level-1"><a href="#logs" class="nav-item">logs</a></li></ul><ul><li class="nav-level-1"><a href="#port-forward" class="nav-item">port-forward</a></li></ul><ul><li class="nav-level-1"><a href="#proxy" class="nav-item">proxy</a></li></ul><ul><li class="nav-level-1"><a href="#top" class="nav-item">top</a></li><ul id="top-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-node-em-" class="nav-item"><em>node</em></a></li><li class="nav-level-2"><a href="#-em-pod-em-" class="nav-item"><em>pod</em></a></li></ul></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-cluster-management-strong-" class="nav-item"><strong>CLUSTER MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#api-versions" class="nav-item">api-versions</a></li></ul><ul><li class="nav-level-1"><a href="#certificate" class="nav-item">certificate</a></li><ul id="certificate-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-approve-em-" class="nav-item"><em>approve</em></a></li><li class="nav-level-2"><a href="#-em-deny-em-" class="nav-item"><em>deny</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#cluster-info" class="nav-item">cluster-info</a></li><ul id="cluster-info-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-dump-em-" class="nav-item"><em>dump</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#cordon" class="nav-item">cordon</a></li></ul><ul><li class="nav-level-1"><a href="#drain" class="nav-item">drain</a></li></ul><ul><li class="nav-level-1"><a href="#taint" class="nav-item">taint</a></li></ul><ul><li class="nav-level-1"><a href="#uncordon" class="nav-item">uncordon</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-kubectl-settings-and-usage-strong-" class="nav-item"><strong>KUBECTL SETTINGS AND USAGE</strong></a></li></ul><ul><li class="nav-level-1"><a href="#completion" class="nav-item">completion</a></li></ul><ul><li class="nav-level-1"><a href="#config" class="nav-item">config</a></li><ul id="config-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-current-context-em-" class="nav-item"><em>current-context</em></a></li><li class="nav-level-2"><a href="#-em-delete-cluster-em-" class="nav-item"><em>delete-cluster</em></a></li><li class="nav-level-2"><a href="#-em-delete-context-em-" class="nav-item"><em>delete-context</em></a></li><li class="nav-level-2"><a href="#-em-get-clusters-em-" class="nav-item"><em>get-clusters</em></a></li><li class="nav-level-2"><a href="#-em-get-contexts-em-" class="nav-item"><em>get-contexts</em></a></li><li class="nav-level-2"><a href="#-em-set-em-" class="nav-item"><em>set</em></a></li><li class="nav-level-2"><a href="#-em-set-cluster-em-" class="nav-item"><em>set-cluster</em></a></li><li class="nav-level-2"><a href="#-em-set-context-em-" class="nav-item"><em>set-context</em></a></li><li class="nav-level-2"><a href="#-em-set-credentials-em-" class="nav-item"><em>set-credentials</em></a></li><li class="nav-level-2"><a href="#-em-unset-em-" class="nav-item"><em>unset</em></a></li><li class="nav-level-2"><a href="#-em-use-context-em-" class="nav-item"><em>use-context</em></a></li><li class="nav-level-2"><a href="#-em-view-em-" class="nav-item"><em>view</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#explain" class="nav-item">explain</a></li></ul><ul><li class="nav-level-1"><a href="#options" class="nav-item">options</a></li></ul><ul><li class="nav-level-1"><a href="#version" class="nav-item">version</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-deprecated-commands-strong-" class="nav-item"><strong>DEPRECATED COMMANDS</strong></a></li></ul><ul><li class="nav-level-1"><a href="#stop" class="nav-item">stop</a></li></ul><br/><div class="copyright"><a href="https://github.com/kubernetes/kubernetes">Copyright 2016 The Kubernetes Authors.</a></div></div>
<div id="wrapper">
<div id="code-tabs-wrapper" class="code-tabs"><ul class="code-tab-list"><li class="code-tab" id="example">example</li></ul></div>
<div id="page-content-wrapper" class="body-content container-fluid"><h1 id="-strong-getting-started-strong-"><strong>GETTING STARTED</strong></h1>
<p>This section contains the most basic commands for getting a workload
running on your cluster.</p>
<ul>
<li><code>run</code> will start running 1 or more instances of a container image on your cluster.</li>
<li><code>expose</code> will load balance traffic across the running instances, and can create a HA proxy for accessing the containers from outside the cluster.</li>
</ul>
<p>Once your workloads are running, you can use the commands in the
<a href="#-strong-working-with-apps-strong-">WORKING WITH APPS</a> section to
inspect them.</p>
<hr>
<h1 id="run">run</h1>
<blockquote class="code-block example">
<p> Start a single instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> nginx <span class="hljs-comment">--image=nginx</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and let the container expose port 5701 .</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> hazelcast <span class="hljs-comment">--image=hazelcast --port=5701</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and set environment variables &quot;DNS_DOMAIN=cluster&quot; and &quot;POD_NAMESPACE=default&quot; in the container.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl run hazelcast --<span class="hljs-keyword">image</span>=hazelcast --<span class="hljs-keyword">env</span>=<span class="hljs-string">"DNS_DOMAIN=cluster"</span> --<span class="hljs-keyword">env</span>=<span class="hljs-string">"POD_NAMESPACE=default"</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a replicated instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> nginx <span class="hljs-comment">--image=nginx --replicas=5</span>
</code></pre>
<blockquote class="code-block example">
<p> Dry run. Print the corresponding API objects without creating them.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> nginx --<span class="hljs-built_in">image</span>=nginx --dry-<span class="hljs-built_in">run</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">run </span><span class="hljs-string">nginx </span><span class="hljs-built_in">--image=nginx</span> <span class="hljs-built_in">--overrides='{</span> <span class="hljs-string">"apiVersion"</span>: <span class="hljs-string">"v1"</span>, <span class="hljs-string">"spec"</span>: { ... } }<span class="hljs-string">'</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a pod of busybox and keep it in the foreground, don&#39;t restart it if it exits.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> -i -t busybox <span class="hljs-comment">--image=busybox --restart=Never</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl run nginx --image=nginx -- <span class="hljs-tag">&lt;<span class="hljs-name">arg1</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">arg2</span>&gt;</span> ... <span class="hljs-tag">&lt;<span class="hljs-name">argN</span>&gt;</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using a different command and custom arguments.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl run nginx --image=nginx --<span class="hljs-keyword">command</span> -- <span class="hljs-symbol">&lt;cmd&gt;</span> <span class="hljs-symbol">&lt;arg1&gt;</span> ... <span class="hljs-symbol">&lt;argN&gt;</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the perl container to compute π to 2000 places and print it out.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> <span class="hljs-literal">pi</span> <span class="hljs-comment">--image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the cron job to compute π to 2000 places and print it out every 5 minutes.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> pi --schedule=<span class="hljs-string">"0/5 * * * ?"</span> --<span class="hljs-built_in">image</span>=perl --restart=OnFailure -- perl -Mbignum=bpi -wle <span class="hljs-string">'print bpi(2000)'</span>
</code></pre>
<p>Create and run a particular image, possibly replicated. </p>
<p>Creates a deployment or job to manage the created container(s).</p>
<h3 id="usage">Usage</h3>
<p><code>$ run NAME --image=image [--env=&quot;key=value&quot;] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>attach</td>
<td></td>
<td>false</td>
<td>If true, wait for the Pod to start running, and then attach to the Pod as if &#39;kubectl attach ...&#39; were called. Default false, unless &#39;-i/--stdin&#39; is set, in which case the default is true. With &#39;--restart=Never&#39; the exit code of the container process is returned. </td>
</tr>
<tr>
<td>command</td>
<td></td>
<td>false</td>
<td>If true and extra arguments are present, use them as the &#39;command&#39; field in the container, rather than the &#39;args&#39; field which is the default. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>env</td>
<td></td>
<td>[]</td>
<td>Environment variables to set in the container </td>
</tr>
<tr>
<td>expose</td>
<td></td>
<td>false</td>
<td>If true, a public, external service is created for the container(s) which are run </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td></td>
<td>The name of the API generator to use, see <a href="http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators">http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators</a> for a list. </td>
</tr>
<tr>
<td>hostport</td>
<td></td>
<td>-1</td>
<td>The host port mapping for the container port. To demonstrate a single-machine container. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td></td>
<td>The image for the container to run. </td>
</tr>
<tr>
<td>image-pull-policy</td>
<td></td>
<td></td>
<td>The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>labels</td>
<td>l</td>
<td></td>
<td>Labels to apply to the pod(s). </td>
</tr>
<tr>
<td>leave-stdin-open</td>
<td></td>
<td>false</td>
<td>If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes. </td>
</tr>
<tr>
<td>limits</td>
<td></td>
<td></td>
<td>The resource requirement limits for this container. For example, &#39;cpu=200m,memory=512Mi&#39;. Note that server side components may assign limits depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. </td>
</tr>
<tr>
<td>port</td>
<td></td>
<td></td>
<td>The port that this container exposes. If --expose is true, this is also the port used by the service that is created. </td>
</tr>
<tr>
<td>quiet</td>
<td></td>
<td>false</td>
<td>If true, suppress prompt messages. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>replicas</td>
<td>r</td>
<td>1</td>
<td>Number of replicas to create for this container. Default is 1. </td>
</tr>
<tr>
<td>requests</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container. For example, &#39;cpu=100m,memory=256Mi&#39;. Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>restart</td>
<td></td>
<td>Always</td>
<td>The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to &#39;Always&#39; a deployment is created, if set to &#39;OnFailure&#39; a job is created, if set to &#39;Never&#39;, a regular pod is created. For the latter two --replicas must be 1. Default &#39;Always&#39;, for CronJobs <code>Never</code>. </td>
</tr>
<tr>
<td>rm</td>
<td></td>
<td>false</td>
<td>If true, delete resources created in this command for attached containers. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schedule</td>
<td></td>
<td></td>
<td>A schedule in the Cron format the job should be run with. </td>
</tr>
<tr>
<td>service-generator</td>
<td></td>
<td>service/v2</td>
<td>The name of the generator to use for creating a service. Only used if --expose is true </td>
</tr>
<tr>
<td>service-overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Keep stdin open on the container(s) in the pod, even if nothing is attached. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Allocated a TTY for each container in the pod. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="expose">expose</h1>
<blockquote class="code-block example">
<p> Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">rc</span> <span class="hljs-comment">nginx</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=80</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">target</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8000</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replication controller identified by type and name specified in &quot;nginx-controller.yaml&quot;, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-literal">-</span><span class="hljs-comment">f</span> <span class="hljs-comment">nginx</span><span class="hljs-literal">-</span><span class="hljs-comment">controller</span><span class="hljs-string">.</span><span class="hljs-comment">yaml</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=80</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">target</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8000</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a pod valid-pod, which serves on port 444 with the name &quot;frontend&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">pod</span> <span class="hljs-comment">valid</span><span class="hljs-literal">-</span><span class="hljs-comment">pod</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=444</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">name=frontend</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a second service based on the above service, exposing the container port 8443 as port 443 with the name &quot;nginx-https&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">service</span> <span class="hljs-comment">nginx</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=443</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">target</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8443</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">name=nginx</span><span class="hljs-literal">-</span><span class="hljs-comment">https</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named &#39;video-stream&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">rc</span> <span class="hljs-comment">streamer</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=4100</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">protocol=udp</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">name=video</span><span class="hljs-literal">-</span><span class="hljs-comment">stream</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">rs</span> <span class="hljs-comment">nginx</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=80</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">target</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8000</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">expose</span> <span class="hljs-comment">deployment</span> <span class="hljs-comment">nginx</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=80</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">target</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8000</span>
</code></pre>
<p>Expose a resource as a new Kubernetes service. </p>
<p>Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes. </p>
<p>Possible resources include (case insensitive): </p>
<p>pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)</p>
<h3 id="usage">Usage</h3>
<p><code>$ expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cluster-ip</td>
<td></td>
<td></td>
<td>ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to &#39;None&#39; to create a headless service. </td>
</tr>
<tr>
<td>container-port</td>
<td></td>
<td></td>
<td>Synonym for --target-port </td>
</tr>
<tr>
<td>create-external-load-balancer</td>
<td></td>
<td>false</td>
<td>If true, create an external load balancer for this service (trumped by --type). Implementation is cloud provider dependent. Default is &#39;false&#39;. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>external-ip</td>
<td></td>
<td></td>
<td>Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to expose a service </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service/v2</td>
<td>The name of the API generator to use. There are 2 generators: &#39;service/v1&#39; and &#39;service/v2&#39;. The only difference between them is that service port in v1 is named &#39;default&#39;, while it is left unnamed in v2. Default is &#39;service/v2&#39;. </td>
</tr>
<tr>
<td>labels</td>
<td>l</td>
<td></td>
<td>Labels to apply to the service created by this call. </td>
</tr>
<tr>
<td>load-balancer-ip</td>
<td></td>
<td></td>
<td>IP to assign to the Load Balancer. If empty, an ephemeral IP will be created and used (cloud-provider specific). </td>
</tr>
<tr>
<td>name</td>
<td></td>
<td></td>
<td>The name for the newly created object. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. </td>
</tr>
<tr>
<td>port</td>
<td></td>
<td></td>
<td>The port that the service should serve on. Copied from the resource being exposed, if unspecified </td>
</tr>
<tr>
<td>protocol</td>
<td></td>
<td></td>
<td>The network protocol for the service to be created. Default is &#39;TCP&#39;. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>selector</td>
<td></td>
<td></td>
<td>A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set. </td>
</tr>
<tr>
<td>session-affinity</td>
<td></td>
<td></td>
<td>If non-empty, set the session affinity for the service to this; legal values: &#39;None&#39;, &#39;ClientIP&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>target-port</td>
<td></td>
<td></td>
<td>Name or number for the port on the container that the service should direct traffic to. Optional. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td></td>
<td>Type for this service: ClusterIP, NodePort, or LoadBalancer. Default is &#39;ClusterIP&#39;. </td>
</tr>
</tbody>
</table>
<h1 id="-strong-app-management-strong-"><strong>APP MANAGEMENT</strong></h1>
<p>This section contains commands for creating, updating, deleting, and
viewing your workloads in a Kubernetes cluster.</p>
<hr>
<h1 id="annotate">annotate</h1>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the annotation &#39;description&#39; and the value &#39;my frontend&#39;. # If the same annotation is set multiple times, only the last value will be applied</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl annotate pods foo description</span>=<span class="hljs-string">'my frontend'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update a pod identified by type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate -f pod<span class="hljs-selector-class">.json</span> description=<span class="hljs-string">'my frontend'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the annotation &#39;description&#39; and the value &#39;my frontend running nginx&#39;, overwriting any existing value.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">annotate </span><span class="hljs-built_in">--overwrite</span> <span class="hljs-string">pods </span><span class="hljs-string">foo </span><span class="hljs-string">description=</span><span class="hljs-string">'my frontend running nginx'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update all pods in the namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">annotate </span><span class="hljs-string">pods </span><span class="hljs-built_in">--all</span> <span class="hljs-string">description=</span><span class="hljs-string">'my frontend running nginx'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; only if the resource is unchanged from version 1.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate pods foo description='<span class="hljs-keyword">my</span> frontend <span class="hljs-built_in">running</span> nginx' <span class="hljs-comment">--resource-version=1</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; by removing an annotation named &#39;description&#39; if it exists. # Does not require the --overwrite flag.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate pods foo <span class="hljs-keyword">description</span>-
</code></pre>
<p>Update the annotations on one or more resources. </p>
<ul>
<li>An annotation is a key/value pair that can hold larger (compared to a label), and possibly not human-readable, data. </li>
<li>It is intended to store non-identifying auxiliary data, especially data manipulated by tools and system extensions. </li>
<li>If --overwrite is true, then existing annotations can be overwritten, otherwise attempting to overwrite an annotation will result in an error. </li>
<li>If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. </li>
</ul>
<p>Valid resource types include: </p>
<ul>
<li>clusters (valid only for federation apiservers) </li>
<li>componentstatuses (aka &#39;cs&#39;) </li>
<li>configmaps (aka &#39;cm&#39;) </li>
<li>daemonsets (aka &#39;ds&#39;) </li>
<li>deployments (aka &#39;deploy&#39;) </li>
<li>endpoints (aka &#39;ep&#39;) </li>
<li>events (aka &#39;ev&#39;) </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;) </li>
<li>ingresses (aka &#39;ing&#39;) </li>
<li>jobs </li>
<li>limitranges (aka &#39;limits&#39;) </li>
<li>namespaces (aka &#39;ns&#39;) </li>
<li>networkpolicies </li>
<li>nodes (aka &#39;no&#39;) </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;) </li>
<li>persistentvolumes (aka &#39;pv&#39;) </li>
<li>pods (aka &#39;po&#39;) </li>
<li>podsecuritypolicies (aka &#39;psp&#39;) </li>
<li>podtemplates </li>
<li>replicasets (aka &#39;rs&#39;) </li>
<li>replicationcontrollers (aka &#39;rc&#39;) </li>
<li>resourcequotas (aka &#39;quota&#39;) </li>
<li>secrets </li>
<li>serviceaccounts (aka &#39;sa&#39;) </li>
<li>services (aka &#39;svc&#39;) </li>
<li>statefulsets </li>
<li>storageclasses </li>
<li>thirdpartyresources</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update the annotation </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, annotation will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="autoscale">autoscale</h1>
<blockquote class="code-block example">
<p> Auto scale a deployment &quot;foo&quot;, with the number of pods between 2 and 10, target CPU utilization specified so a default autoscaling policy will be used:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl autoscale deployment foo --<span class="hljs-built_in">min</span>=<span class="hljs-number">2</span> --<span class="hljs-built_in">max</span>=<span class="hljs-number">10</span>
</code></pre>
<blockquote class="code-block example">
<p> Auto scale a replication controller &quot;foo&quot;, with the number of pods between 1 and 5, target CPU utilization at 80%:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">autoscale</span> <span class="hljs-comment">rc</span> <span class="hljs-comment">foo</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">max=5</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">cpu</span><span class="hljs-literal">-</span><span class="hljs-comment">percent=80</span>
</code></pre>
<p>Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. </p>
<p>Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.</p>
<h3 id="usage">Usage</h3>
<p><code>$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cpu-percent</td>
<td></td>
<td>-1</td>
<td>The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it&#39;s not specified or negative, a default autoscaling policy will be used. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to autoscale. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>horizontalpodautoscaler/v1</td>
<td>The name of the API generator to use. Currently there is only 1 generator. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>max</td>
<td></td>
<td>-1</td>
<td>The upper limit for the number of pods that can be set by the autoscaler. Required. </td>
</tr>
<tr>
<td>min</td>
<td></td>
<td>-1</td>
<td>The lower limit for the number of pods that can be set by the autoscaler. If it&#39;s not specified or negative, the server will apply a default value. </td>
</tr>
<tr>
<td>name</td>
<td></td>
<td></td>
<td>The name for the newly created object. If not specified, the name of the input resource will be used. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="convert">convert</h1>
<blockquote class="code-block example">
<p> Convert &#39;pod.yaml&#39; to latest version and print to stdout.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl convert <span class="hljs-_">-f</span> pod.yaml
</code></pre>
<blockquote class="code-block example">
<p> Convert the live state of the resource specified by &#39;pod.yaml&#39; to the latest version # and print to stdout in json format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">convert</span> -f pod.yaml <span class="hljs-comment">--local -o json</span>
</code></pre>
<blockquote class="code-block example">
<p> Convert all files under current directory to latest version and create them all.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl convert <span class="hljs-_">-f</span> . | kubectl create <span class="hljs-_">-f</span> -
</code></pre>
<p>Convert config files between different API versions. Both YAML and JSON formats are accepted. </p>
<p>The command takes filename, directory, or URL as input, and convert it into format of version specified by --output-version flag. If target version is not specified or not supported, convert to latest version. </p>
<p>The default output will be printed to stdout in YAML format. One can use -o option to change to output destination.</p>
<h3 id="usage">Usage</h3>
<p><code>$ convert -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to need to get converted. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>true</td>
<td>If true, convert will NOT try to contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="create">create</h1>
<blockquote class="code-block example">
<p> Create a pod using the data in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create <span class="hljs-_">-f</span> ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Create a pod based on the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json <span class="hljs-string">| kubectl create -f -</span>
</code></pre>
<blockquote class="code-block example">
<p> Edit the data in docker-registry.yaml in JSON using the v1 API format then create the resource using the edited data.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> -f docker-registry.yaml --<span class="hljs-keyword">edit</span> --<span class="hljs-keyword">output</span>-version=v1 -o json
</code></pre>
<p>Create a resource by filename or stdin. </p>
<p>JSON and YAML formats are accepted.</p>
<h3 id="usage">Usage</h3>
<p><code>$ create -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>edit</td>
<td></td>
<td>false</td>
<td>Edit the API resource before creating </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to create the resource </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>windows-line-endings</td>
<td></td>
<td>false</td>
<td>Only relevant if --edit=true. Use Windows line-endings (default Unix line-endings) </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-configmap-em-"><em>configmap</em></h2>
<blockquote class="code-block example">
<p> Create a new configmap named my-config with keys for each file in folder bar</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create configmap my-config --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=path<span class="hljs-regexp">/to/</span>bar
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config with specified keys instead of names on disk</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create configmap my-config --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=key1=<span class="hljs-regexp">/path/</span>to<span class="hljs-regexp">/bar/</span>file1.txt --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=key2=<span class="hljs-regexp">/path/</span>to<span class="hljs-regexp">/bar/</span>file2.txt
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config with key1=config1 and key2=config2</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create configmap my-<span class="hljs-built_in">config</span> --from-literal=key1=<span class="hljs-built_in">config1</span> --from-literal=key2=<span class="hljs-built_in">config2</span>
</code></pre>
<p>Create a configmap based on a file, directory, or specified literal value. </p>
<p>A single configmap may package one or more key/value pairs. </p>
<p>When creating a configmap based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key, you may specify an alternate key. </p>
<p>When creating a configmap based on a directory, each file whose basename is a valid key in the directory will be packaged into the configmap. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).</p>
<h3 id="usage">Usage</h3>
<p><code>$ configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>from-file</td>
<td></td>
<td>[]</td>
<td>Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid configmap key. </td>
</tr>
<tr>
<td>from-literal</td>
<td></td>
<td>[]</td>
<td>Specify a key and literal value to insert in configmap (i.e. mykey=somevalue) </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>configmap/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-deployment-em-"><em>deployment</em></h2>
<blockquote class="code-block example">
<p> Create a new deployment named my-dep that runs the busybox image.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create deployment <span class="hljs-keyword">my</span>-dep <span class="hljs-comment">--image=busybox</span>
</code></pre>
<p>Create a deployment with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ deployment NAME --image=image [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>deployment-basic/v1beta1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td>[]</td>
<td>Image name to run. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-namespace-em-"><em>namespace</em></h2>
<blockquote class="code-block example">
<p> Create a new namespace named my-namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> <span class="hljs-keyword">namespace</span> my-<span class="hljs-keyword">namespace</span>
</code></pre>
<p>Create a namespace with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ namespace NAME [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>namespace/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-quota-em-"><em>quota</em></h2>
<blockquote class="code-block example">
<p> Create a new resourcequota named my-quota</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl create quota my-quota --hard=cpu=<span class="hljs-number">1</span>,memory=<span class="hljs-number">1</span>G,pods=<span class="hljs-number">2</span>,services=<span class="hljs-number">3</span>,replicationcontrollers=<span class="hljs-number">2</span>,resourcequotas=<span class="hljs-number">1</span>,secrets=<span class="hljs-number">5</span>,persistentvolumeclaims=<span class="hljs-number">10</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a new resourcequota named best-effort</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl <span class="hljs-keyword">create</span> <span class="hljs-keyword">quota</span> best-effort <span class="hljs-comment">--hard=pods=100 --scopes=BestEffort</span>
</code></pre>
<p>Create a resourcequota with the specified name, hard limits and optional scopes</p>
<h3 id="usage">Usage</h3>
<p><code>$ quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>resourcequotas/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>hard</td>
<td></td>
<td></td>
<td>A comma-delimited set of resource=quantity pairs that define a hard limit. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>scopes</td>
<td></td>
<td></td>
<td>A comma-delimited set of quota scopes that must all match each object tracked by the quota. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-em-"><em>secret</em></h2>
<p>Create a secret using specified subcommand.</p>
<h3 id="usage">Usage</h3>
<p><code>$ secret</code></p>
<hr>
<h2 id="-em-secret-docker-registry-em-"><em>secret docker-registry</em></h2>
<blockquote class="code-block example">
<p> If you don&#39;t already have a .dockercfg file, you can create a dockercfg secret directly by using:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">create</span> <span class="hljs-comment">secret</span> <span class="hljs-comment">docker</span><span class="hljs-literal">-</span><span class="hljs-comment">registry</span> <span class="hljs-comment">my</span><span class="hljs-literal">-</span><span class="hljs-comment">secret</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">docker</span><span class="hljs-literal">-</span><span class="hljs-comment">server=DOCKER_REGISTRY_SERVER</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">docker</span><span class="hljs-literal">-</span><span class="hljs-comment">username=DOCKER_USER</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">docker</span><span class="hljs-literal">-</span><span class="hljs-comment">password=DOCKER_PASSWORD</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">docker</span><span class="hljs-literal">-</span><span class="hljs-comment">email=DOCKER_EMAIL</span>
</code></pre>
<p>Create a new secret for use with Docker registries. </p>
<p>Dockercfg secrets are used to authenticate against Docker registries. </p>
<p>When using the Docker command line to push images, you can authenticate to a given registry by running </p>
<p> $ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL&#39;.</p>
<p>That produces a ~/.dockercfg file that is used by subsequent &#39;docker push&#39; and &#39;docker pull&#39; commands to authenticate to the registry. </p>
<p>When creating applications, you may have a Docker registry that requires authentication. In order for the nodes to pull images on your behalf, they have to have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account.</p>
<h3 id="usage">Usage</h3>
<p><code>$ docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>docker-email</td>
<td></td>
<td></td>
<td>Email for Docker registry </td>
</tr>
<tr>
<td>docker-password</td>
<td></td>
<td></td>
<td>Password for Docker registry authentication </td>
</tr>
<tr>
<td>docker-server</td>
<td></td>
<td><a href="https://index.docker.io/v1/">https://index.docker.io/v1/</a></td>
<td>Server location for Docker registry </td>
</tr>
<tr>
<td>docker-username</td>
<td></td>
<td></td>
<td>Username for Docker registry authentication </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret-for-docker-registry/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-generic-em-"><em>secret generic</em></h2>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with keys for each file in folder bar</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create secret <span class="hljs-keyword">generic</span> my-secret --from-<span class="hljs-keyword">file</span>=path/<span class="hljs-keyword">to</span>/bar
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with specified keys instead of names on disk</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create secret generic my-secret --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=ssh-privatekey=~<span class="hljs-regexp">/.ssh/i</span>d_rsa --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=ssh-publickey=~<span class="hljs-regexp">/.ssh/i</span>d_rsa.pub
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with key1=supersecret and key2=topsecret</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create secret <span class="hljs-keyword">generic</span> my-secret --<span class="hljs-keyword">from</span>-literal=key1=supersecret --<span class="hljs-keyword">from</span>-literal=key2=topsecret
</code></pre>
<p>Create a secret based on a file, directory, or specified literal value. </p>
<p>A single secret may package one or more key/value pairs. </p>
<p>When creating a secret based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key, you may specify an alternate key. </p>
<p>When creating a secret based on a directory, each file whose basename is a valid key in the directory will be packaged into the secret. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).</p>
<h3 id="usage">Usage</h3>
<p><code>$ generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>from-file</td>
<td></td>
<td>[]</td>
<td>Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key. </td>
</tr>
<tr>
<td>from-literal</td>
<td></td>
<td>[]</td>
<td>Specify a key and literal value to insert in secret (i.e. mykey=somevalue) </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td></td>
<td>The type of secret to create </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-tls-em-"><em>secret tls</em></h2>
<blockquote class="code-block example">
<p> Create a new TLS secret named tls-secret with the given key pair:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create secret tls tls-secret --cert=path/<span class="hljs-keyword">to</span>/tls.cert --<span class="hljs-keyword">key</span>=path/<span class="hljs-keyword">to</span>/tls.<span class="hljs-keyword">key</span>
</code></pre>
<p>Create a TLS secret from the given public/private key pair. </p>
<p>The public/private key pair must exist before hand. The public key certificate must be .PEM encoded and match the given private key.</p>
<h3 id="usage">Usage</h3>
<p><code>$ tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cert</td>
<td></td>
<td></td>
<td>Path to PEM encoded public key certificate. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret-for-tls/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>key</td>
<td></td>
<td></td>
<td>Path to private key associated with given certificate. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-em-"><em>service</em></h2>
<p>Create a service using specified subcommand.</p>
<h3 id="usage">Usage</h3>
<p><code>$ service</code></p>
<hr>
<h2 id="-em-service-clusterip-em-"><em>service clusterip</em></h2>
<blockquote class="code-block example">
<p> Create a new clusterIP service named my-cs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create service clusterip <span class="hljs-keyword">my</span>-cs <span class="hljs-comment">--tcp=5678:8080</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a new clusterIP service named my-cs (in headless mode)</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create service clusterip <span class="hljs-keyword">my</span>-cs <span class="hljs-comment">--clusterip="None"</span>
</code></pre>
<p>Create a clusterIP service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ clusterip NAME [--tcp=&lt;port&gt;:&lt;targetPort&gt;] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>clusterip</td>
<td></td>
<td></td>
<td>Assign your own ClusterIP or set to &#39;None&#39; for a &#39;headless&#39; service (no loadbalancing). </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-clusterip/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-loadbalancer-em-"><em>service loadbalancer</em></h2>
<blockquote class="code-block example">
<p> Create a new LoadBalancer service named my-lbs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create service loadbalancer <span class="hljs-keyword">my</span>-lbs <span class="hljs-comment">--tcp=5678:8080</span>
</code></pre>
<p>Create a LoadBalancer service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ loadbalancer NAME [--tcp=port:targetPort] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-loadbalancer/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-nodeport-em-"><em>service nodeport</em></h2>
<blockquote class="code-block example">
<p> Create a new nodeport service named my-ns</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create service nodeport <span class="hljs-keyword">my</span>-ns <span class="hljs-comment">--tcp=5678:8080</span>
</code></pre>
<p>Create a nodeport service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ nodeport NAME [--tcp=port:targetPort] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-nodeport/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>node-port</td>
<td></td>
<td>0</td>
<td>Port used to expose the service on each node in a cluster. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-serviceaccount-em-"><em>serviceaccount</em></h2>
<blockquote class="code-block example">
<p> Create a new service account named my-service-account</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl <span class="hljs-keyword">create</span> serviceaccount my-service-<span class="hljs-keyword">account</span>
</code></pre>
<p>Create a service account with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ serviceaccount NAME [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>serviceaccount/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="delete">delete</h1>
<blockquote class="code-block example">
<p> Delete a pod using the type and name specified in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">delete</span> -f ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Delete a pod based on the type and name in the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">cat</span> pod.json | kubectl <span class="hljs-keyword">delete</span> -<span class="hljs-keyword">f</span> -
</code></pre>
<blockquote class="code-block example">
<p> Delete pods and services with same names &quot;baz&quot; and &quot;foo&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">delete</span> pod,service baz foo
</code></pre>
<blockquote class="code-block example">
<p> Delete pods and services with label name=myLabel.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">delete</span> pods,services -l <span class="hljs-keyword">name</span>=myLabel
</code></pre>
<blockquote class="code-block example">
<p> Delete a pod with minimal delay</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">delete</span> pod foo <span class="hljs-comment">--now</span>
</code></pre>
<blockquote class="code-block example">
<p> Force delete a pod on a dead node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">delete</span> <span class="hljs-comment">pod</span> <span class="hljs-comment">foo</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">grace</span><span class="hljs-literal">-</span><span class="hljs-comment">period=0</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">force</span>
</code></pre>
<blockquote class="code-block example">
<p> Delete a pod with UID 1234-56-7890-234234-456456.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl delete pod <span class="hljs-number">1234</span><span class="hljs-number">-56</span><span class="hljs-number">-7890</span><span class="hljs-number">-234234</span><span class="hljs-number">-456456</span>
</code></pre>
<blockquote class="code-block example">
<p> Delete all pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">delete</span> pods <span class="hljs-comment">--all</span>
</code></pre>
<p>Delete resources by filenames, stdin, resources and names, or by resources and label selector. </p>
<p>JSON and YAML formats are accepted. Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector. </p>
<p>Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must pass a grace period of 0 and specify the --force flag. </p>
<p>IMPORTANT: Force deleting pods does not wait for confirmation that the pod&#39;s processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately. </p>
<p>Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.</p>
<h3 id="usage">Usage</h3>
<p><code>$ delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>[-all] to select all the specified resources. </td>
</tr>
<tr>
<td>cascade</td>
<td></td>
<td>true</td>
<td>If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files containing the resource to delete. </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>ignore-not-found</td>
<td></td>
<td>false</td>
<td>Treat &quot;resource not found&quot; as a successful delete. Defaults to &quot;true&quot; when --all is specified. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>now</td>
<td></td>
<td>false</td>
<td>If true, resources are signaled for immediate shutdown (same as --grace-period=1). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="edit">edit</h1>
<blockquote class="code-block example">
<p> Edit the service named &#39;docker-registry&#39;:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">edit</span> svc/docker-registry
</code></pre>
<blockquote class="code-block example">
<p> Use an alternative editor</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attr">KUBE_EDITOR</span>=<span class="hljs-string">"nano"</span> kubectl edit svc/docker-registry
</code></pre>
<blockquote class="code-block example">
<p> Edit the service &#39;docker-registry&#39; in JSON using the v1 API format:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">edit</span> svc/docker-registry --<span class="hljs-keyword">output</span>-version=v1 -o json
</code></pre>
<p>Edit a resource from the default editor. </p>
<p>The edit command allows you to directly edit any API resource you can retrieve via the command line tools. It will open the editor defined by your KUBE _EDITOR, or EDITOR environment variables, or fall back to &#39;vi&#39; for Linux or &#39;notepad&#39; for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts filenames as well as command line arguments, although the files you point to must be previously saved versions of resources. </p>
<p>The files to edit will be output in the default API version, or a version specified by --output-version. The default format is YAML - if you would like to edit in JSON pass -o json. The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used. </p>
<p>In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.</p>
<h3 id="usage">Usage</h3>
<p><code>$ edit (RESOURCE/NAME | -f FILENAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to edit the resource </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td>yaml</td>
<td>Output format. One of: yaml&#124;json. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>windows-line-endings</td>
<td></td>
<td>false</td>
<td>Use Windows line-endings (default Unix line-endings) </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="get">get</h1>
<blockquote class="code-block example">
<p> List all pods in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> pods
</code></pre>
<blockquote class="code-block example">
<p> List all pods in ps output format with more information (such as node name).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> pods -o wide
</code></pre>
<blockquote class="code-block example">
<p> List a single replication controller with specified NAME in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> replicationcontroller web
</code></pre>
<blockquote class="code-block example">
<p> List a single pod in JSON output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> -o json pod web-pod<span class="hljs-number">-13</span>je7
</code></pre>
<blockquote class="code-block example">
<p> List a pod identified by type and name specified in &quot;pod.yaml&quot; in JSON output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl get -f pod<span class="hljs-selector-class">.yaml</span> -o json
</code></pre>
<blockquote class="code-block example">
<p> Return only the phase value of the specified pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">get</span> -o <span class="hljs-keyword">template</span> pod/web-pod<span class="hljs-number">-13</span>je7 --<span class="hljs-keyword">template</span>={{.status.phase}}
</code></pre>
<blockquote class="code-block example">
<p> List all replication controllers and services together in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> rc,services
</code></pre>
<blockquote class="code-block example">
<p> List one or more resources by their type and names.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">get</span> rc/web service/frontend pods/web-pod<span class="hljs-number">-13</span>je7
</code></pre>
<p>Display one or many resources. </p>
<p>Valid resource types include: </p>
<ul>
<li>clusters (valid only for federation apiservers) </li>
<li>componentstatuses (aka &#39;cs&#39;) </li>
<li>configmaps (aka &#39;cm&#39;) </li>
<li>daemonsets (aka &#39;ds&#39;) </li>
<li>deployments (aka &#39;deploy&#39;) </li>
<li>endpoints (aka &#39;ep&#39;) </li>
<li>events (aka &#39;ev&#39;) </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;) </li>
<li>ingresses (aka &#39;ing&#39;) </li>
<li>jobs </li>
<li>limitranges (aka &#39;limits&#39;) </li>
<li>namespaces (aka &#39;ns&#39;) </li>
<li>networkpolicies </li>
<li>nodes (aka &#39;no&#39;) </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;) </li>
<li>persistentvolumes (aka &#39;pv&#39;) </li>
<li>pods (aka &#39;po&#39;) </li>
<li>podsecuritypolicies (aka &#39;psp&#39;) </li>
<li>podtemplates </li>
<li>replicasets (aka &#39;rs&#39;) </li>
<li>replicationcontrollers (aka &#39;rc&#39;) </li>
<li>resourcequotas (aka &#39;quota&#39;) </li>
<li>secrets </li>
<li>serviceaccounts (aka &#39;sa&#39;) </li>
<li>services (aka &#39;svc&#39;) </li>
<li>statefulsets </li>
<li>storageclasses </li>
<li>thirdpartyresources </li>
</ul>
<p>This command will hide resources that have completed. For instance, pods that are in the Succeeded or Failed phases. You can see the full results for any resource by providing the &#39;--show-all&#39; flag. </p>
<p>By specifying the output as &#39;template&#39; and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resource(s).</p>
<h3 id="usage">Usage</h3>
<p><code>$ get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>export</td>
<td></td>
<td>false</td>
<td>If true, use &#39;export&#39; for the resources. Exported resources are stripped of cluster-specific information. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>label-columns</td>
<td>L</td>
<td>[]</td>
<td>Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>raw</td>
<td></td>
<td></td>
<td>Raw URI to request from the server. Uses the transport specified by the kubeconfig file. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-kind</td>
<td></td>
<td>false</td>
<td>If present, list the resource type for the requested object(s). </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>watch</td>
<td>w</td>
<td>false</td>
<td>After listing/getting the requested object, watch for changes. </td>
</tr>
<tr>
<td>watch-only</td>
<td></td>
<td>false</td>
<td>Watch for changes to the requested object(s), without listing/getting first. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="label">label</h1>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the label &#39;unhealthy&#39; and the value &#39;true&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods foo unhealthy=<span class="hljs-literal">true</span></span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the label &#39;status&#39; and the value &#39;unhealthy&#39;, overwriting any existing value.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> --overwrite pods foo status=unhealthy</span>
</code></pre>
<blockquote class="code-block example">
<p> Update all pods in the namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods --all status=unhealthy</span>
</code></pre>
<blockquote class="code-block example">
<p> Update a pod identified by the type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-selector-tag">label</span> -f pod<span class="hljs-selector-class">.json</span> status=unhealthy
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; only if the resource is unchanged from version 1.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods foo status=unhealthy --resource-version=1</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; by removing a label named &#39;bar&#39; if it exists. # Does not require the --overwrite flag.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods foo bar-</span>
</code></pre>
<p>Update the labels on a resource. </p>
<ul>
<li>A label must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters. </li>
<li>If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error. </li>
<li>If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update the labels </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, label will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>If non-empty, the labels update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="patch">patch</h1>
<blockquote class="code-block example">
<p> Partially update a node using strategic merge patch</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch <span class="hljs-keyword">node</span> <span class="hljs-title">k8s-node-1</span> -p '{<span class="hljs-string">"spec"</span>:{<span class="hljs-string">"unschedulable"</span>:<span class="hljs-literal">true</span>}}'
</code></pre>
<blockquote class="code-block example">
<p> Partially update a node identified by the type and name specified in &quot;node.json&quot; using strategic merge patch</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch -f <span class="hljs-keyword">node</span>.<span class="hljs-title">json</span> -p '{<span class="hljs-string">"spec"</span>:{<span class="hljs-string">"unschedulable"</span>:<span class="hljs-literal">true</span>}}'
</code></pre>
<blockquote class="code-block example">
<p> Update a container&#39;s image; spec.containers[*].name is required because it&#39;s a merge key</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch pod valid-pod -p <span class="hljs-string">'{"</span>spec<span class="hljs-string">":{"</span>containers<span class="hljs-string">":[{"</span>name<span class="hljs-string">":"</span>kubernetes-serve-hostname<span class="hljs-string">","</span>image<span class="hljs-string">":"</span>new image<span class="hljs-string">"}]}}'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update a container&#39;s image using a json patch with positional arrays</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch pod valid-pod --<span class="hljs-class"><span class="hljs-keyword">type</span></span>=<span class="hljs-symbol">'jso</span>n' -p='[{<span class="hljs-string">"op"</span>: <span class="hljs-string">"replace"</span>, <span class="hljs-string">"path"</span>: <span class="hljs-string">"/spec/containers/0/image"</span>, <span class="hljs-string">"value"</span>:<span class="hljs-string">"new image"</span>}]'
</code></pre>
<p>Update field(s) of a resource using strategic merge patch </p>
<p>JSON and YAML formats are accepted. </p>
<p>Please refer to the models in <a href="https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html">https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html</a> to find if a field is mutable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ patch (-f FILENAME | TYPE NAME) -p PATCH</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, patch will operate on the content of the file, not the server-side resource. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>patch</td>
<td>p</td>
<td></td>
<td>The patch to be applied to the resource JSON file. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td>strategic</td>
<td>The type of patch being provided; one of [json merge strategic] </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="replace">replace</h1>
<blockquote class="code-block example">
<p> Replace a pod using the data in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl replace <span class="hljs-_">-f</span> ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Replace a pod based on the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">replace</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Update a single-container pod&#39;s image version (tag) to v4</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl get pod mypod -o yaml | <span class="hljs-type">sed</span> 's/\(image: myimage\):.*$/\<span class="hljs-number">1</span>:v4/' | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">replace</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Force replace, delete and then re-create the resource</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">replace</span> <span class="hljs-comment">--force -f ./pod.json</span>
</code></pre>
<p>Replace a resource by filename or stdin. </p>
<p>JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by </p>
<p> $ kubectl get TYPE NAME -o yaml</p>
<p>Please refer to the models in <a href="https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html">https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html</a> to find if a field is mutable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ replace -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cascade</td>
<td></td>
<td>false</td>
<td>Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to replace the resource. </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Delete and re-create the specified resource </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="rolling-update">rolling-update</h1>
<blockquote class="code-block example">
<p> Update pods of frontend-v1 using new replication controller data in frontend-v2.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> -f frontend-<span class="hljs-built_in">v2</span>.json
</code></pre>
<blockquote class="code-block example">
<p> Update pods of frontend-v1 using JSON data passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">cat</span> frontend-v2.json | kubectl <span class="hljs-keyword">rolling</span>-<span class="hljs-keyword">update</span> frontend-v1 -f -
</code></pre>
<blockquote class="code-block example">
<p> Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the # name of the replication controller.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> frontend-<span class="hljs-built_in">v2</span> --image<span class="hljs-symbol">=image</span>:<span class="hljs-built_in">v2</span>
</code></pre>
<blockquote class="code-block example">
<p> Update the pods of frontend by just changing the image, and keeping the old name.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rolling-update frontend --<span class="hljs-built_in">image</span>=<span class="hljs-built_in">image</span>:v2
</code></pre>
<blockquote class="code-block example">
<p> Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> frontend-<span class="hljs-built_in">v2</span> --rollback
</code></pre>
<p>Perform a rolling update of the given ReplicationController. </p>
<p>Replaces the specified replication controller with a new replication controller by updating one pod at a time to use the new PodTemplate. The new-controller.json must specify the same namespace as the existing replication controller and overwrite at least one (common) label in its replicaSelector. </p>
<p>! <a href="http://kubernetes.io/images/docs/kubectl_rollingupdate.svg">http://kubernetes.io/images/docs/kubectl_rollingupdate.svg</a></p>
<h3 id="usage">Usage</h3>
<p><code>$ rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td></td>
<td></td>
<td>Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod </td>
</tr>
<tr>
<td>deployment-label-key</td>
<td></td>
<td>deployment</td>
<td>The key to use to differentiate between two different controllers, default &#39;deployment&#39;. Only relevant when --image is specified, ignored otherwise </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename or URL to file to use to create the new replication controller. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td></td>
<td>Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f </td>
</tr>
<tr>
<td>image-pull-policy</td>
<td></td>
<td></td>
<td>Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>poll-interval</td>
<td></td>
<td>3s</td>
<td>Time delay between polling for replication controller status after the update. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>rollback</td>
<td></td>
<td>false</td>
<td>If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>5m0s</td>
<td>Max time to wait for a replication controller to update before giving up. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>update-period</td>
<td></td>
<td>1m0s</td>
<td>Time to wait between updating pods. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="rollout">rollout</h1>
<blockquote class="code-block example">
<p> Rollback to the previous deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<p>Manage a deployment using subcommands like &quot;kubectl rollout undo deployment/abc&quot;</p>
<h3 id="usage">Usage</h3>
<p><code>$ rollout SUBCOMMAND</code></p>
<hr>
<h2 id="-em-history-em-"><em>history</em></h2>
<blockquote class="code-block example">
<p> View the rollout history of a deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">history</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<blockquote class="code-block example">
<p> View the details of deployment revision 3</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">history</span> deployment/<span class="hljs-keyword">abc</span> --revision=<span class="hljs-number">3</span>
</code></pre>
<p>View previous rollout revisions and configurations.</p>
<h3 id="usage">Usage</h3>
<p><code>$ history (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>revision</td>
<td></td>
<td>0</td>
<td>See the details, including podTemplate of the revision specified </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-pause-em-"><em>pause</em></h2>
<blockquote class="code-block example">
<p> Mark the nginx deployment as paused. Any current state of # the deployment will continue its function, new updates to the deployment will not # have an effect as long as the deployment is paused.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-built_in">pause</span> deployment/nginx
</code></pre>
<p>Mark the provided resource as paused </p>
<p>Paused resources will not be reconciled by a controller. Use \&quot;kubectl rollout resume \&quot; to resume a paused resource. Currently only deployments support being paused.</p>
<h3 id="usage">Usage</h3>
<p><code>$ pause RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-resume-em-"><em>resume</em></h2>
<blockquote class="code-block example">
<p> Resume an already paused deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">resume</span> deployment/nginx
</code></pre>
<p>Resume a paused resource </p>
<p>Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.</p>
<h3 id="usage">Usage</h3>
<p><code>$ resume RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-status-em-"><em>status</em></h2>
<blockquote class="code-block example">
<p> Watch the rollout status of a deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">status</span> deployment/nginx
</code></pre>
<p>Show the status of the rollout. </p>
<p>By default &#39;rollout status&#39; will watch the status of the latest rollout until it&#39;s done. If you don&#39;t want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then &#39;rollout status&#39; will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, use --revision=N where N is the revision you need to watch for.</p>
<h3 id="usage">Usage</h3>
<p><code>$ status (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>revision</td>
<td></td>
<td>0</td>
<td>Pin to a specific revision for showing its status. Defaults to 0 (last revision). </td>
</tr>
<tr>
<td>watch</td>
<td>w</td>
<td>true</td>
<td>Watch the status of the rollout until it&#39;s done. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-undo-em-"><em>undo</em></h2>
<blockquote class="code-block example">
<p> Rollback to the previous deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<blockquote class="code-block example">
<p> Rollback to deployment revision 3</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> deployment/<span class="hljs-keyword">abc</span> --<span class="hljs-keyword">to</span>-revision=<span class="hljs-number">3</span>
</code></pre>
<blockquote class="code-block example">
<p> Rollback to the previous deployment with dry-run</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout undo --dry-<span class="hljs-keyword">run</span><span class="bash">=<span class="hljs-literal">true</span> deployment/abc</span>
</code></pre>
<p>Rollback to a previous rollout.</p>
<h3 id="usage">Usage</h3>
<p><code>$ undo (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>to-revision</td>
<td></td>
<td>0</td>
<td>The revision to rollback to. Default to 0 (last revision). </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="scale">scale</h1>
<blockquote class="code-block example">
<p> Scale a replicaset named &#39;foo&#39; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-comment">--replicas=3 rs/foo</span>
</code></pre>
<blockquote class="code-block example">
<p> Scale a resource identified by type and name specified in &quot;foo.yaml&quot; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-comment">--replicas=3 -f foo.yaml</span>
</code></pre>
<blockquote class="code-block example">
<p> If the deployment named mysql&#39;s current size is 2, scale mysql to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">scale</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">current</span><span class="hljs-literal">-</span><span class="hljs-comment">replicas=2</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">replicas=3</span> <span class="hljs-comment">deployment/mysql</span>
</code></pre>
<blockquote class="code-block example">
<p> Scale multiple replication controllers.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">scale</span> --replicas=<span class="hljs-number">5</span> rc/foo rc/<span class="hljs-built_in">bar</span> rc/baz
</code></pre>
<blockquote class="code-block example">
<p> Scale job named &#39;cron&#39; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-comment">--replicas=3 job/cron</span>
</code></pre>
<p>Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. </p>
<p>Scale also allows users to specify one or more preconditions for the scale action. </p>
<p>If --current-replicas or --resource-version is specified, it is validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server.</p>
<h3 id="usage">Usage</h3>
<p><code>$ scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>current-replicas</td>
<td></td>
<td>-1</td>
<td>Precondition for current size. Requires that the current size of the resource match this value in order to scale. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to set a new size </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>replicas</td>
<td></td>
<td>-1</td>
<td>The new desired number of replicas. Required. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>Precondition for resource version. Requires that the current resource version match this value in order to scale. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up on a scale operation, zero means don&#39;t wait. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="set">set</h1>
<p>Configure application resources </p>
<p>These commands help you make changes to existing application resources.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set SUBCOMMAND</code></p>
<hr>
<h2 id="-em-image-em-"><em>image</em></h2>
<blockquote class="code-block example">
<p> Set a deployment&#39;s nginx container image to &#39;nginx:1.9.1&#39;, and its busybox container image to &#39;busybox&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl set image deployment/nginx <span class="hljs-attr">busybox=busybox</span> <span class="hljs-attr">nginx=nginx:1.9.1</span>
</code></pre>
<blockquote class="code-block example">
<p> Update all deployments&#39; and rc&#39;s nginx container&#39;s image to &#39;nginx:1.9.1&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> image deployments,rc nginx=nginx:<span class="hljs-number">1.9</span><span class="hljs-number">.1</span> <span class="hljs-comment">--all</span>
</code></pre>
<blockquote class="code-block example">
<p> Update image of all containers of daemonset abc to &#39;nginx:1.9.1&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> image <span class="hljs-comment">daemonset abc *=nginx:1.9.1</span>
</code></pre>
<blockquote class="code-block example">
<p> Print result (in yaml format) of updating nginx container image from local file, without hitting the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> image -f path/<span class="hljs-keyword">to</span>/<span class="hljs-built_in">file</span>.yaml nginx=nginx:<span class="hljs-number">1.9</span><span class="hljs-number">.1</span> <span class="hljs-comment">--local -o yaml</span>
</code></pre>
<p>Update existing container image(s) of resources. </p>
<p>Possible resources include (case insensitive): </p>
<p> pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)</p>
<h3 id="usage">Usage</h3>
<p><code>$ image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set image will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-resources-em-"><em>resources</em></h2>
<blockquote class="code-block example">
<p> Set a deployments nginx container cpu limits to &quot;200m&quot; and memory to &quot;512Mi&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> resources deployment nginx -c=nginx <span class="hljs-comment">--limits=cpu=200m,memory=512Mi</span>
</code></pre>
<blockquote class="code-block example">
<p> Set the resource request and limits for all containers in nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl set resources deployment nginx --limits=cpu=<span class="hljs-number">200</span>m,memory=<span class="hljs-number">512</span>Mi --requests=cpu=<span class="hljs-number">100</span>m,memory=<span class="hljs-number">256</span>Mi
</code></pre>
<blockquote class="code-block example">
<p> Remove the resource requests for resources on containers in nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl set resources deployment nginx --limits=cpu=<span class="hljs-number">0</span>,memory=<span class="hljs-number">0</span> --requests=cpu=<span class="hljs-number">0</span>,memory=<span class="hljs-number">0</span>
</code></pre>
<blockquote class="code-block example">
<p> Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> resources -f path/<span class="hljs-keyword">to</span>/<span class="hljs-built_in">file</span>.yaml <span class="hljs-comment">--limits=cpu=200m,memory=512Mi --local -o yaml</span>
</code></pre>
<p>Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits. </p>
<p>for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit. </p>
<p>Possible resources include (case insensitive): replicationcontroller, deployment, daemonset, job, replicaset.</p>
<h3 id="usage">Usage</h3>
<p><code>$ resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS &amp; --requests=REQUESTS]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>containers</td>
<td>c</td>
<td>*</td>
<td>The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>limits</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container. For example, &#39;cpu=100m,memory=256Mi&#39;. Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set resources will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>requests</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container. For example, &#39;cpu=100m,memory=256Mi&#39;. Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<h1 id="-strong-declarative-app-management-strong-"><strong>DECLARATIVE APP MANAGEMENT</strong></h1>
<hr>
<h1 id="apply">apply</h1>
<blockquote class="code-block example">
<p> Apply the configuration in pod.json to a pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl apply <span class="hljs-_">-f</span> ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Apply the JSON passed into stdin to a pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">apply</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all the other resources that are not in the file and match label app=nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl apply --prune <span class="hljs-_">-f</span> manifest.yaml <span class="hljs-_">-l</span> app=nginx
</code></pre>
<blockquote class="code-block example">
<p> Apply the configuration in manifest.yaml and delete all the other configmaps that are not in the file.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">apply</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prune</span> <span class="hljs-literal">-</span><span class="hljs-comment">f</span> <span class="hljs-comment">manifest</span><span class="hljs-string">.</span><span class="hljs-comment">yaml</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">all</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prune</span><span class="hljs-literal">-</span><span class="hljs-comment">whitelist=core/v1/ConfigMap</span>
</code></pre>
<p>Apply a configuration to a resource by filename or stdin. The resource name must be specified. This resource will be created if it doesn&#39;t exist yet. To use &#39;apply&#39;, always create the resource initially with either &#39;apply&#39; or &#39;create --save-config&#39;. </p>
<p>JSON and YAML formats are accepted. </p>
<p>Alpha Disclaimer: the --prune functionality is not yet complete. Do not use unless you are aware of what the current state is. See <a href="https://issues.k8s.io/34274">https://issues.k8s.io/34274</a>.</p>
<h3 id="usage">Usage</h3>
<p><code>$ apply -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>[-all] to select all the specified resources. </td>
</tr>
<tr>
<td>cascade</td>
<td></td>
<td>true</td>
<td>Only relevant during a prune or a force apply. If true, cascade the deletion of the resources managed by pruned or deleted resources (e.g. Pods created by a ReplicationController). </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files that contains the configuration to apply </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Delete and re-create the specified resource, when PATCH encounters conflict and has retried for 5 times. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Only relevant during a prune or a force apply. Period of time in seconds given to pruned or deleted resources to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>true</td>
<td>Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration </td>
</tr>
<tr>
<td>prune</td>
<td></td>
<td>false</td>
<td>Automatically delete resource objects that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all. </td>
</tr>
<tr>
<td>prune-whitelist</td>
<td></td>
<td>[]</td>
<td>Overwrite the default whitelist with <group/version/kind> for --prune </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>Only relevant during a force apply. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<h1 id="-strong-working-with-apps-strong-"><strong>WORKING WITH APPS</strong></h1>
<p>This section contains commands for inspecting and debugging your
applications.</p>
<ul>
<li><code>logs</code> will print the logs from the specified pod + container.</li>
<li><code>exec</code> can be used to get an interactive shell on a pod + container.</li>
<li><code>describe</code> will print debug information about the given resource.</li>
</ul>
<hr>
<h1 id="attach">attach</h1>
<blockquote class="code-block example">
<p> Get output from running pod 123456-7890, using the first container by default</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span>
</code></pre>
<blockquote class="code-block example">
<p> Get output from ruby-container from pod 123456-7890</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container
</code></pre>
<blockquote class="code-block example">
<p> Switch to raw terminal mode, sends stdin to &#39;bash&#39; in ruby-container from pod 123456-7890 # and sends stdout/stderr from &#39;bash&#39; back to the client</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container -i -t
</code></pre>
<p>Attach to a process that is already running inside an existing container.</p>
<h3 id="usage">Usage</h3>
<p><code>$ attach POD -c CONTAINER</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Pass stdin to the container </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Stdin is a TTY </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cp">cp</h1>
<blockquote class="code-block example">
<p> !!!Important Note!!! # Requires that the &#39;tar&#39; binary is present in your container # image. If &#39;tar&#39; is not present, &#39;kubectl cp&#39; will fail. # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp /tmp/foo_dir &lt;some-pod&gt;<span class="hljs-symbol">:/tmp/bar_dir</span>
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>bar -c <span class="hljs-params">&lt;specific-container&gt;</span>
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace></p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-params">&lt;some-namespace&gt;</span>/<span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>bar
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo from a remote pod to /tmp/bar locally</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-params">&lt;some-namespace&gt;</span>/<span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-meta-keyword">/tmp/</span>bar
</code></pre>
<p>Copy files and directories to and from containers.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cp &lt;file-spec-src&gt; &lt;file-spec-dest&gt;</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="describe">describe</h1>
<blockquote class="code-block example">
<p> Describe a node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl describe nodes kubernetes-<span class="hljs-keyword">node</span><span class="hljs-title">-emt8</span>.c.myproject.internal
</code></pre>
<blockquote class="code-block example">
<p> Describe a pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">describe</span> pods/nginx
</code></pre>
<blockquote class="code-block example">
<p> Describe a pod identified by type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl describe <span class="hljs-_">-f</span> pod.json
</code></pre>
<blockquote class="code-block example">
<p> Describe all pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl describe pods</span>
</code></pre>
<blockquote class="code-block example">
<p> Describe pods by label name=myLabel</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">describe</span> po -l <span class="hljs-keyword">name</span>=myLabel
</code></pre>
<blockquote class="code-block example">
<p> Describe all pods managed by the &#39;frontend&#39; replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl describe pods frontend</span>
</code></pre>
<p>Show details of a specific resource or group of resources. This command joins many API calls together to form a detailed description of a given resource or group of resources. </p>
<p> $ kubectl describe TYPE NAME_PREFIX</p>
<p>will first check for an exact match on TYPE and NAME PREFIX. If no such resource exists, it will output details for every resource that has a name prefixed with NAME PREFIX. </p>
<p>Valid resource types include: </p>
<ul>
<li>clusters (valid only for federation apiservers) </li>
<li>componentstatuses (aka &#39;cs&#39;) </li>
<li>configmaps (aka &#39;cm&#39;) </li>
<li>daemonsets (aka &#39;ds&#39;) </li>
<li>deployments (aka &#39;deploy&#39;) </li>
<li>endpoints (aka &#39;ep&#39;) </li>
<li>events (aka &#39;ev&#39;) </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;) </li>
<li>ingresses (aka &#39;ing&#39;) </li>
<li>jobs </li>
<li>limitranges (aka &#39;limits&#39;) </li>
<li>namespaces (aka &#39;ns&#39;) </li>
<li>networkpolicies </li>
<li>nodes (aka &#39;no&#39;) </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;) </li>
<li>persistentvolumes (aka &#39;pv&#39;) </li>
<li>pods (aka &#39;po&#39;) </li>
<li>podsecuritypolicies (aka &#39;psp&#39;) </li>
<li>podtemplates </li>
<li>replicasets (aka &#39;rs&#39;) </li>
<li>replicationcontrollers (aka &#39;rc&#39;) </li>
<li>resourcequotas (aka &#39;quota&#39;) </li>
<li>secrets </li>
<li>serviceaccounts (aka &#39;sa&#39;) </li>
<li>services (aka &#39;svc&#39;) </li>
<li>statefulsets </li>
<li>storageclasses </li>
<li>thirdpartyresources</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files containing the resource to describe </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-events</td>
<td></td>
<td>true</td>
<td>If true, display events related to the described object. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="exec">exec</h1>
<blockquote class="code-block example">
<p> Get output from running &#39;date&#39; from pod 123456-7890, using the first container by default</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">exec</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> <span class="hljs-built_in">date</span>
</code></pre>
<blockquote class="code-block example">
<p> Get output from running &#39;date&#39; in ruby-container from pod 123456-7890</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">exec</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-<span class="hljs-keyword">container</span> <span class="hljs-keyword">date</span>
</code></pre>
<blockquote class="code-block example">
<p> Switch to raw terminal mode, sends stdin to &#39;bash&#39; in ruby-container from pod 123456-7890 # and sends stdout/stderr from &#39;bash&#39; back to the client</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl exec <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container -i -t -- bash -il
</code></pre>
<p>Execute a command in a container.</p>
<h3 id="usage">Usage</h3>
<p><code>$ exec POD [-c CONTAINER] -- COMMAND [args...]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
<tr>
<td>pod</td>
<td>p</td>
<td></td>
<td>Pod name </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Pass stdin to the container </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Stdin is a TTY </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="logs">logs</h1>
<blockquote class="code-block example">
<p> Return snapshot logs from pod nginx with only one container</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl logs nginx</span>
</code></pre>
<blockquote class="code-block example">
<p> Return snapshot of previous terminated ruby container logs from pod web-1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs -<span class="hljs-selector-tag">p</span> -c ruby web-<span class="hljs-number">1</span>
</code></pre>
<blockquote class="code-block example">
<p> Begin streaming the logs of the ruby container in pod web-1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-_">-f</span> -c ruby web-1
</code></pre>
<blockquote class="code-block example">
<p> Display only the most recent 20 lines of output in pod nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-comment">--tail=20 nginx</span>
</code></pre>
<blockquote class="code-block example">
<p> Show all logs from pod nginx written in the last hour</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-comment">--since=1h nginx</span>
</code></pre>
<p>Print the logs for a container in a pod. If the pod has only one container, the container name is optional.</p>
<h3 id="usage">Usage</h3>
<p><code>$ logs [-f] [-p] POD [-c CONTAINER]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Print the logs of this container </td>
</tr>
<tr>
<td>follow</td>
<td>f</td>
<td>false</td>
<td>Specify if the logs should be streamed. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>interactive</td>
<td></td>
<td>false</td>
<td>If true, prompt the user for input when required. </td>
</tr>
<tr>
<td>limit-bytes</td>
<td></td>
<td>0</td>
<td>Maximum bytes of logs to return. Defaults to no limit. </td>
</tr>
<tr>
<td>previous</td>
<td>p</td>
<td>false</td>
<td>If true, print the logs for the previous instance of the container in a pod if it exists. </td>
</tr>
<tr>
<td>since</td>
<td></td>
<td>0s</td>
<td>Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used. </td>
</tr>
<tr>
<td>since-time</td>
<td></td>
<td></td>
<td>Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used. </td>
</tr>
<tr>
<td>tail</td>
<td></td>
<td>-1</td>
<td>Lines of recent log file to display. Defaults to -1, showing all log lines. </td>
</tr>
<tr>
<td>timestamps</td>
<td></td>
<td>false</td>
<td>Include timestamps on each line in the log output </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="port-forward">port-forward</h1>
<blockquote class="code-block example">
<p> Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl port-forward mypod <span class="hljs-number">5000</span> <span class="hljs-number">6000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on port 8888 locally, forwarding to 5000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">port-forward</span> <span class="hljs-selector-tag">mypod</span> 8888<span class="hljs-selector-pseudo">:5000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on a random port locally, forwarding to 5000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">port-forward</span> <span class="hljs-selector-tag">mypod</span> <span class="hljs-selector-pseudo">:5000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on a random port locally, forwarding to 5000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">port-forward</span> <span class="hljs-selector-tag">mypod</span> 0<span class="hljs-selector-pseudo">:5000</span>
</code></pre>
<p>Forward one or more local ports to a pod.</p>
<h3 id="usage">Usage</h3>
<p><code>$ port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>pod</td>
<td>p</td>
<td></td>
<td>Pod name </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="proxy">proxy</h1>
<blockquote class="code-block example">
<p> Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">proxy</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">port=8011</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">www=</span><span class="hljs-string">.</span><span class="hljs-comment">/local/www/</span>
</code></pre>
<blockquote class="code-block example">
<p> Run a proxy to kubernetes apiserver on an arbitrary local port. # The chosen port for the server will be output to stdout.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl proxy <span class="hljs-comment">--port=0</span>
</code></pre>
<blockquote class="code-block example">
<p> Run a proxy to kubernetes apiserver, changing the api prefix to k8s-api # This makes e.g. the pods api available at localhost:8011/k8s-api/v1/pods/</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl proxy <span class="hljs-comment">--api-prefix=/k8s-api</span>
</code></pre>
<p>To proxy all of the kubernetes api and nothing else, use: </p>
<p> $ kubectl proxy --api-prefix=/</p>
<p>To proxy only part of the kubernetes api and also some static files: </p>
<p> $ kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/</p>
<p>The above lets you &#39;curl localhost:8001/api/v1/pods&#39;. </p>
<p>To proxy the entire kubernetes api at a different root, use: </p>
<p> $ kubectl proxy --api-prefix=/custom/</p>
<p>The above lets you &#39;curl localhost:8001/custom/api/v1/pods&#39;</p>
<h3 id="usage">Usage</h3>
<p><code>$ proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>accept-hosts</td>
<td></td>
<td>^localhost$,^127.0.0.1$,^[::1]$</td>
<td>Regular expression for hosts that the proxy should accept. </td>
</tr>
<tr>
<td>accept-paths</td>
<td></td>
<td>^/.*</td>
<td>Regular expression for paths that the proxy should accept. </td>
</tr>
<tr>
<td>address</td>
<td></td>
<td>127.0.0.1</td>
<td>The IP address on which to serve on. </td>
</tr>
<tr>
<td>api-prefix</td>
<td></td>
<td>/</td>
<td>Prefix to serve the proxied API under. </td>
</tr>
<tr>
<td>disable-filter</td>
<td></td>
<td>false</td>
<td>If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port. </td>
</tr>
<tr>
<td>port</td>
<td>p</td>
<td>8001</td>
<td>The port on which to run the proxy. Set to 0 to pick a random port. </td>
</tr>
<tr>
<td>reject-methods</td>
<td></td>
<td>POST,PUT,PATCH</td>
<td>Regular expression for HTTP methods that the proxy should reject. </td>
</tr>
<tr>
<td>reject-paths</td>
<td></td>
<td>^/api/.<em>/pods/.</em>/exec,^/api/.<em>/pods/.</em>/attach</td>
<td>Regular expression for paths that the proxy should reject. </td>
</tr>
<tr>
<td>unix-socket</td>
<td>u</td>
<td></td>
<td>Unix socket on which to run the proxy. </td>
</tr>
<tr>
<td>www</td>
<td>w</td>
<td></td>
<td>Also serve static files from the given directory under the specified prefix. </td>
</tr>
<tr>
<td>www-prefix</td>
<td>P</td>
<td>/static/</td>
<td>Prefix to serve static files under, if static file directory is specified. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="top">top</h1>
<p>Display Resource (CPU/Memory/Storage) usage. </p>
<p>The top command allows you to see the resource consumption for nodes or pods.</p>
<h3 id="usage">Usage</h3>
<p><code>$ top</code></p>
<hr>
<h2 id="-em-node-em-"><em>node</em></h2>
<blockquote class="code-block example">
<p> Show metrics for all nodes</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top <span class="hljs-keyword">node</span><span class="hljs-title"></span>
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for a given node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top <span class="hljs-keyword">node</span> <span class="hljs-title">NODE_NAME</span>
</code></pre>
<p>Display Resource (CPU/Memory/Storage) usage of nodes. </p>
<p>The top-node command allows you to see the resource consumption of nodes.</p>
<h3 id="usage">Usage</h3>
<p><code>$ node [NAME | -l label]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-pod-em-"><em>pod</em></h2>
<blockquote class="code-block example">
<p> Show metrics for all pods in the default namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">top</span> pod
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for all pods in the given namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod --<span class="hljs-keyword">namespace</span>=NAMESPACE
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for a given pod and its containers</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod POD_NAME <span class="hljs-comment">--containers</span>
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for the pods defined by label name=myLabel</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod -l <span class="hljs-built_in">name</span>=myLabel
</code></pre>
<p>Display Resource (CPU/Memory/Storage) usage of pods. </p>
<p>The &#39;top pod&#39; command allows you to see the resource consumption of pods. </p>
<p>Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.</p>
<h3 id="usage">Usage</h3>
<p><code>$ pod [NAME | -l label]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>containers</td>
<td></td>
<td>false</td>
<td>If present, print usage of containers within a pod. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
</tbody>
</table>
<h1 id="-strong-cluster-management-strong-"><strong>CLUSTER MANAGEMENT</strong></h1>
<hr>
<h1 id="api-versions">api-versions</h1>
<h3 id="usage">Usage</h3>
<p><code>$ api-versions</code></p>
<hr>
<h1 id="certificate">certificate</h1>
<h3 id="usage">Usage</h3>
<p><code>$ certificate SUBCOMMAND</code></p>
<hr>
<h2 id="-em-approve-em-"><em>approve</em></h2>
<p>Approve a certificate signing request. </p>
<p>kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attributes requested in the CSR. </p>
<p>SECURITY NOTICE: Depending on the requested attributes, the issued certificate can potentially grant a requester access to cluster resources or to authenticate as a requested identity. Before approving a CSR, ensure you understand what the signed certificate can do.</p>
<h3 id="usage">Usage</h3>
<p><code>$ approve (-f FILENAME | NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-deny-em-"><em>deny</em></h2>
<p>Deny a certificate signing request. </p>
<p>kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.</p>
<h3 id="usage">Usage</h3>
<p><code>$ deny (-f FILENAME | NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cluster-info">cluster-info</h1>
<p>Display addresses of the master and services with label kubernetes.io/cluster-service=true To further debug and diagnose cluster problems, use &#39;kubectl cluster-info dump&#39;.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cluster-info</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-dump-em-"><em>dump</em></h2>
<blockquote class="code-block example">
<p> Dump current cluster state to stdout</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> cluster-<span class="hljs-literal">info</span> dump
</code></pre>
<blockquote class="code-block example">
<p> Dump current cluster state to /path/to/cluster-state</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cluster-info <span class="hljs-keyword">dump</span> --output-directory=<span class="hljs-regexp">/path/</span>to<span class="hljs-regexp">/cluster-state</span>
</code></pre>
<blockquote class="code-block example">
<p> Dump all namespaces to stdout</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> cluster-<span class="hljs-literal">info</span> dump --all-namespaces
</code></pre>
<blockquote class="code-block example">
<p> Dump a set of namespaces to /path/to/cluster-state</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">cluster</span>-info dump --namespaces <span class="hljs-keyword">default</span>,kube-<span class="hljs-keyword">system</span> --output-directory=/path/to/<span class="hljs-keyword">cluster</span>-state
</code></pre>
<p>Dumps cluster info out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, kubernetes will build a set of files in that directory. By default only dumps things in the &#39;kube-system&#39; namespace, but you can switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces. </p>
<p>The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories based on namespace and pod name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ dump</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If true, dump all namespaces. If true, --namespaces is ignored. </td>
</tr>
<tr>
<td>namespaces</td>
<td></td>
<td>[]</td>
<td>A comma separated list of namespaces to dump. </td>
</tr>
<tr>
<td>output-directory</td>
<td></td>
<td></td>
<td>Where to output the files. If empty or &#39;-&#39; uses stdout, otherwise creates a directory hierarchy in that directory </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cordon">cordon</h1>
<blockquote class="code-block example">
<p> Mark node &quot;foo&quot; as unschedulable.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl cordon foo</span>
</code></pre>
<p>Mark node as unschedulable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cordon NODE</code></p>
<hr>
<h1 id="drain">drain</h1>
<blockquote class="code-block example">
<p> Drain node &quot;foo&quot;, even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet on it.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl drain foo <span class="hljs-comment">--force</span>
</code></pre>
<blockquote class="code-block example">
<p> As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, and use a grace period of 15 minutes.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl drain foo <span class="hljs-comment">--grace-period=900</span>
</code></pre>
<p>Drain node in preparation for maintenance. </p>
<p>The given node will be marked unschedulable to prevent new pods from arriving. &#39;drain&#39; evicts the pods if the APIServer supports eviciton (<a href="http://kubernetes.io/docs/admin/disruptions/">http://kubernetes.io/docs/admin/disruptions/</a>). Otherwise, it will use normal DELETE to delete the pods. The &#39;drain&#39; evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then drain will not delete any pods unless you use --force. </p>
<p>&#39;drain&#39; waits for graceful termination. You should not operate on the machine until the command completes. </p>
<p>When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again. </p>
<p>! <a href="http://kubernetes.io/images/docs/kubectl_drain.svg">http://kubernetes.io/images/docs/kubectl_drain.svg</a></p>
<h3 id="usage">Usage</h3>
<p><code>$ drain NODE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>delete-local-data</td>
<td></td>
<td>false</td>
<td>Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained). </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used. </td>
</tr>
<tr>
<td>ignore-daemonsets</td>
<td></td>
<td>false</td>
<td>Ignore DaemonSet-managed pods. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up, zero means infinite </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="taint">taint</h1>
<blockquote class="code-block example">
<p> Update node &#39;foo&#39; with a taint with key &#39;dedicated&#39; and value &#39;special-user&#39; and effect &#39;NoSchedule&#39;. # If a taint with that key and effect already exists, its value is replaced as specified.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl taint nodes foo dedicated=<span class="hljs-keyword">special</span>-user:NoSchedule
</code></pre>
<blockquote class="code-block example">
<p> Remove from node &#39;foo&#39; the taint with key &#39;dedicated&#39; and effect &#39;NoSchedule&#39; if one exists.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">taint</span> <span class="hljs-selector-tag">nodes</span> <span class="hljs-selector-tag">foo</span> <span class="hljs-selector-tag">dedicated</span><span class="hljs-selector-pseudo">:NoSchedule-</span>
</code></pre>
<blockquote class="code-block example">
<p> Remove from node &#39;foo&#39; all the taints with key &#39;dedicated&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> taint nodes foo dedicated-
</code></pre>
<p>Update the taints on one or more nodes. </p>
<ul>
<li>A taint consists of a key, value, and effect. As an argument here, it is expressed as key=value:effect. </li>
<li>The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 253 characters. </li>
<li>The value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 253 characters. </li>
<li>The effect must be NoSchedule or PreferNoSchedule. </li>
<li>Currently taint can only apply to node.</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>select all nodes in the cluster </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow taints to be overwritten, otherwise reject taint updates that overwrite existing taints. </td>
</tr>
<tr>
<td>schema-cache-dir</td>
<td></td>
<td>~/.kube/schema</td>
<td>If non-empty, load/store cached API schemas in this directory, default is &#39;$HOME/.kube/schema&#39; </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="uncordon">uncordon</h1>
<blockquote class="code-block example">
<p> Mark node &quot;foo&quot; as schedulable.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-variable">$ </span>kubectl uncordon foo
</code></pre>
<p>Mark node as schedulable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ uncordon NODE</code></p>
<h1 id="-strong-kubectl-settings-and-usage-strong-"><strong>KUBECTL SETTINGS AND USAGE</strong></h1>
<hr>
<h1 id="completion">completion</h1>
<p>Output shell completion code for the given shell (bash or zsh). </p>
<p>This command prints shell code which must be evaluation to provide interactive completion of kubectl commands. </p>
<p> $ source &lt;(kubectl completion bash)</p>
<p>will load the kubectl completion code for bash. Note that this depends on the bash-completion framework. It must be sourced before sourcing the kubectl completion, e.g. on the Mac: </p>
<p> $ brew install bash-completion
$ source $(brew --prefix)/etc/bash_completion
$ source &lt;(kubectl completion bash)</p>
<p>If you use zsh [1], the following will load kubectl zsh completion: </p>
<p> $ source &lt;(kubectl completion zsh)</p>
<p> [1] zsh completions are only supported in versions of zsh &gt;= 5.2</p>
<h3 id="usage">Usage</h3>
<p><code>$ completion SHELL</code></p>
<hr>
<h1 id="config">config</h1>
<p>Modify kubeconfig files using subcommands like &quot;kubectl config set current-context my-context&quot; </p>
<p>The loading order follows these rules: </p>
<ol>
<li>If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place. </li>
<li>If $KUBECONFIG environment variable is set, then it is used a list of paths (normal path delimitting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. </li>
<li>Otherwise, ${HOME}/.kube/config is used and no merging takes place.</li>
</ol>
<h3 id="usage">Usage</h3>
<p><code>$ config SUBCOMMAND</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>kubeconfig</td>
<td></td>
<td></td>
<td>use a particular kubeconfig file </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-current-context-em-"><em>current-context</em></h2>
<blockquote class="code-block example">
<p> Display the current-context</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">config</span> current-<span class="hljs-built_in">context</span>
</code></pre>
<p>Displays the current-context</p>
<h3 id="usage">Usage</h3>
<p><code>$ current-context</code></p>
<hr>
<h2 id="-em-delete-cluster-em-"><em>delete-cluster</em></h2>
<h3 id="usage">Usage</h3>
<p><code>$ delete-cluster NAME</code></p>
<hr>
<h2 id="-em-delete-context-em-"><em>delete-context</em></h2>
<h3 id="usage">Usage</h3>
<p><code>$ delete-context NAME</code></p>
<hr>
<h2 id="-em-get-clusters-em-"><em>get-clusters</em></h2>
<h3 id="usage">Usage</h3>
<p><code>$ get-clusters</code></p>
<hr>
<h2 id="-em-get-contexts-em-"><em>get-contexts</em></h2>
<blockquote class="code-block example">
<p> List all the contexts in your kubeconfig file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">config</span> <span class="hljs-built_in">get</span>-contexts
</code></pre>
<blockquote class="code-block example">
<p> Describe one context in your kubeconfig file.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">get-contexts</span> <span class="hljs-string">my-context</span>
</code></pre>
<p>Displays one or many contexts from the kubeconfig file.</p>
<h3 id="usage">Usage</h3>
<p><code>$ get-contexts [(-o|--output=)name)]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-em-"><em>set</em></h2>
<p>Sets an individual value in a kubeconfig file </p>
<p>PROPERTY _NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots. </p>
<p>PROPERTY _VALUE is the new value you wish to set. Binary fields such as &#39;certificate-authority-data&#39; expect a base64 encoded string unless the --set-raw-bytes flag is used.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set PROPERTY_NAME PROPERTY_VALUE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>set-raw-bytes</td>
<td></td>
<td>false</td>
<td>When writing a []byte PROPERTY_VALUE, write the given string directly without base64 decoding. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-cluster-em-"><em>set-cluster</em></h2>
<blockquote class="code-block example">
<p> Set only the server field on the e2e cluster entry without touching other values.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-cluster</span> <span class="hljs-string">e2e </span><span class="hljs-built_in">--server=https://1.2.3.4</span>
</code></pre>
<blockquote class="code-block example">
<p> Embed certificate authority data for the e2e cluster entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-cluster</span> <span class="hljs-string">e2e </span><span class="hljs-built_in">--certificate-authority=~/.kube/e2e/kubernetes.ca.crt</span>
</code></pre>
<blockquote class="code-block example">
<p> Disable cert checking for the dev cluster entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-cluster</span> <span class="hljs-string">e2e </span><span class="hljs-built_in">--insecure-skip-tls-verify=true</span>
</code></pre>
<p>Sets a cluster entry in kubeconfig. </p>
<p>Specifying a name that already exists will merge new fields on top of existing values for those fields.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>api-version</td>
<td></td>
<td></td>
<td>api-version for the cluster entry in kubeconfig </td>
</tr>
<tr>
<td>certificate-authority</td>
<td></td>
<td></td>
<td>path to certificate-authority file for the cluster entry in kubeconfig </td>
</tr>
<tr>
<td>embed-certs</td>
<td></td>
<td>false</td>
<td>embed-certs for the cluster entry in kubeconfig </td>
</tr>
<tr>
<td>insecure-skip-tls-verify</td>
<td></td>
<td>false</td>
<td>insecure-skip-tls-verify for the cluster entry in kubeconfig </td>
</tr>
<tr>
<td>server</td>
<td></td>
<td></td>
<td>server for the cluster entry in kubeconfig </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-context-em-"><em>set-context</em></h2>
<blockquote class="code-block example">
<p> Set the user field on the gce context entry without touching other values</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-context</span> <span class="hljs-string">gce </span><span class="hljs-built_in">--user=cluster-admin</span>
</code></pre>
<p>Sets a context entry in kubeconfig </p>
<p>Specifying a name that already exists will merge new fields on top of existing values for those fields.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-context NAME [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cluster</td>
<td></td>
<td></td>
<td>cluster for the context entry in kubeconfig </td>
</tr>
<tr>
<td>namespace</td>
<td></td>
<td></td>
<td>namespace for the context entry in kubeconfig </td>
</tr>
<tr>
<td>user</td>
<td></td>
<td></td>
<td>user for the context entry in kubeconfig </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-credentials-em-"><em>set-credentials</em></h2>
<blockquote class="code-block example">
<p> Set only the &quot;client-key&quot; field on the &quot;cluster-admin&quot; # entry, without touching other values:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--client-key=~/.kube/admin.key</span>
</code></pre>
<blockquote class="code-block example">
<p> Set basic auth for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--username=admin</span> <span class="hljs-built_in">--password=uXFGweU9l35qcif</span>
</code></pre>
<blockquote class="code-block example">
<p> Embed client certificate data in the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--client-certificate=~/.kube/admin.crt</span> <span class="hljs-built_in">--embed-certs=true</span>
</code></pre>
<blockquote class="code-block example">
<p> Enable the Google Compute Platform auth provider for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--auth-provider=gcp</span>
</code></pre>
<blockquote class="code-block example">
<p> Enable the OpenID Connect auth provider for the &quot;cluster-admin&quot; entry with additional args</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--auth-provider=oidc</span> <span class="hljs-built_in">--auth-provider-arg=client-id=foo</span> <span class="hljs-built_in">--auth-provider-arg=client-secret=bar</span>
</code></pre>
<blockquote class="code-block example">
<p> Remove the &quot;client-secret&quot; config value for the OpenID Connect auth provider for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">set-credentials</span> <span class="hljs-string">cluster-admin </span><span class="hljs-built_in">--auth-provider=oidc</span> <span class="hljs-built_in">--auth-provider-arg=client-secret-</span>
</code></pre>
<p>Sets a user entry in kubeconfig </p>
<p>Specifying a name that already exists will merge new fields on top of existing values. </p>
<p> Client-certificate flags:
--client-certificate=certfile --client-key=keyfile</p>
<p> Bearer token flags:
--token=bearer_token</p>
<p> Basic auth flags:
--username=basic_user --password=basic_password</p>
<p>Bearer token and basic auth are mutually exclusive.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>auth-provider</td>
<td></td>
<td></td>
<td>auth provider for the user entry in kubeconfig </td>
</tr>
<tr>
<td>auth-provider-arg</td>
<td></td>
<td>[]</td>
<td>&#39;key=value&#39; arugments for the auth provider </td>
</tr>
<tr>
<td>client-certificate</td>
<td></td>
<td></td>
<td>path to client-certificate file for the user entry in kubeconfig </td>
</tr>
<tr>
<td>client-key</td>
<td></td>
<td></td>
<td>path to client-key file for the user entry in kubeconfig </td>
</tr>
<tr>
<td>embed-certs</td>
<td></td>
<td>false</td>
<td>embed client cert/key for the user entry in kubeconfig </td>
</tr>
<tr>
<td>password</td>
<td></td>
<td></td>
<td>password for the user entry in kubeconfig </td>
</tr>
<tr>
<td>token</td>
<td></td>
<td></td>
<td>token for the user entry in kubeconfig </td>
</tr>
<tr>
<td>username</td>
<td></td>
<td></td>
<td>username for the user entry in kubeconfig </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-unset-em-"><em>unset</em></h2>
<p>Unsets an individual value in a kubeconfig file </p>
<p>PROPERTY _NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.</p>
<h3 id="usage">Usage</h3>
<p><code>$ unset PROPERTY_NAME</code></p>
<hr>
<h2 id="-em-use-context-em-"><em>use-context</em></h2>
<p>Sets the current-context in a kubeconfig file</p>
<h3 id="usage">Usage</h3>
<p><code>$ use-context CONTEXT_NAME</code></p>
<hr>
<h2 id="-em-view-em-"><em>view</em></h2>
<blockquote class="code-block example">
<p> Show Merged kubeconfig settings.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">config</span> view
</code></pre>
<blockquote class="code-block example">
<p> Get the password for the e2e user</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">config</span> view -o <span class="hljs-keyword">jsonpath='{.users[?(@.name </span>== <span class="hljs-string">"e2e"</span>)].user.password}<span class="hljs-string">'</span>
</code></pre>
<p>Display merged kubeconfig settings or a specified kubeconfig file. </p>
<p>You can use --output jsonpath={...} to extract specific values using a jsonpath expression.</p>
<h3 id="usage">Usage</h3>
<p><code>$ view</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>flatten</td>
<td></td>
<td>false</td>
<td>flatten the resulting kubeconfig file into self-contained output (useful for creating portable kubeconfig files) </td>
</tr>
<tr>
<td>merge</td>
<td></td>
<td>true</td>
<td>merge the full hierarchy of kubeconfig files </td>
</tr>
<tr>
<td>minify</td>
<td></td>
<td>false</td>
<td>remove all information not used by current-context from the output </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;). </td>
</tr>
<tr>
<td>raw</td>
<td></td>
<td>false</td>
<td>display raw byte data </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>false</td>
<td>When printing, show all resources (default hide terminated pods.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="explain">explain</h1>
<blockquote class="code-block example">
<p> Get the documentation of the resource and its fields</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl explain pods</span>
</code></pre>
<blockquote class="code-block example">
<p> Get the documentation of a specific field of a resource</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl explain pods<span class="hljs-selector-class">.spec</span><span class="hljs-selector-class">.containers</span>
</code></pre>
<p>Documentation of resources. </p>
<p>Valid resource types include: </p>
<ul>
<li>clusters (valid only for federation apiservers) </li>
<li>componentstatuses (aka &#39;cs&#39;) </li>
<li>configmaps (aka &#39;cm&#39;) </li>
<li>daemonsets (aka &#39;ds&#39;) </li>
<li>deployments (aka &#39;deploy&#39;) </li>
<li>endpoints (aka &#39;ep&#39;) </li>
<li>events (aka &#39;ev&#39;) </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;) </li>
<li>ingresses (aka &#39;ing&#39;) </li>
<li>jobs </li>
<li>limitranges (aka &#39;limits&#39;) </li>
<li>namespaces (aka &#39;ns&#39;) </li>
<li>networkpolicies </li>
<li>nodes (aka &#39;no&#39;) </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;) </li>
<li>persistentvolumes (aka &#39;pv&#39;) </li>
<li>pods (aka &#39;po&#39;) </li>
<li>podsecuritypolicies (aka &#39;psp&#39;) </li>
<li>podtemplates </li>
<li>replicasets (aka &#39;rs&#39;) </li>
<li>replicationcontrollers (aka &#39;rc&#39;) </li>
<li>resourcequotas (aka &#39;quota&#39;) </li>
<li>secrets </li>
<li>serviceaccounts (aka &#39;sa&#39;) </li>
<li>services (aka &#39;svc&#39;) </li>
<li>statefulsets </li>
<li>storageclasses </li>
<li>thirdpartyresources</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ explain RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>recursive</td>
<td></td>
<td>false</td>
<td>Print the fields of fields (Currently only 1 level deep) </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="options">options</h1>
<h3 id="usage">Usage</h3>
<p><code>$ options</code></p>
<hr>
<h1 id="version">version</h1>
<h3 id="usage">Usage</h3>
<p><code>$ version</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>client</td>
<td>c</td>
<td>false</td>
<td>Client version only (no server required). </td>
</tr>
<tr>
<td>short</td>
<td></td>
<td>false</td>
<td>Print just the version number. </td>
</tr>
</tbody>
</table>
<h1 id="-strong-deprecated-commands-strong-"><strong>DEPRECATED COMMANDS</strong></h1>
<hr>
<h1 id="stop">stop</h1>
<blockquote class="code-block example">
<p> Shut down foo.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">stop</span> replicationcontroller foo
</code></pre>
<blockquote class="code-block example">
<p> Stop pods and services with label name=myLabel.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">stop</span> pods,services -l <span class="hljs-keyword">name</span>=myLabel
</code></pre>
<blockquote class="code-block example">
<p> Shut down the service defined in service.json</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">stop</span> -f service.json
</code></pre>
<blockquote class="code-block example">
<p> Shut down all resources in the path/to/resources directory</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">stop</span> -f path/<span class="hljs-keyword">to</span>/<span class="hljs-built_in">resources</span>
</code></pre>
<p>Deprecated: This command is deprecated, all its functionalities are covered by &quot;kubectl delete&quot;</p>
<h3 id="usage">Usage</h3>
<p><code>$ stop (-f FILENAME | TYPE (NAME | -l label | --all))</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>[-all] to select all the specified resources. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files of resource(s) to be stopped. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>ignore-not-found</td>
<td></td>
<td>false</td>
<td>Treat &quot;resource not found&quot; as a successful stop. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object </td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/jquery.scrollto/jquery.scrollTo.min.js"></script>
<script src="navData.js"></script>
<script src="scroll.js"></script>
<!--<script src="actions.js"></script>-->
<script src="tabvisibility.js"></script>
</body>
</html>