Create cmd to generate kubectl yaml docs

This commit is contained in:
Thomas Liu 2016-04-11 17:05:57 -07:00
parent a57bba498f
commit ad9f9d2ce0
34 changed files with 3708 additions and 0 deletions

View File

@ -0,0 +1,169 @@
/*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"gopkg.in/yaml.v2"
"k8s.io/kubernetes/cmd/genutils"
"k8s.io/kubernetes/pkg/kubectl/cmd"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
)
type cmdOption struct {
Name string
Shorthand string `yaml:",omitempty"`
DefaultValue string `yaml:"default_value,omitempty"`
Usage string `yaml:",omitempty"`
}
type cmdDoc struct {
Name string
Synopsis string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Options []cmdOption `yaml:",omitempty"`
InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"`
Example string `yaml:",omitempty"`
SeeAlso []string `yaml:"see_also,omitempty"`
}
func main() {
path := "docs/yaml/kubectl"
if len(os.Args) == 2 {
path = os.Args[1]
} else if len(os.Args) > 2 {
fmt.Fprintf(os.Stderr, "usage: %s [output directory]\n", os.Args[0])
os.Exit(1)
}
outDir, err := genutils.OutDir(path)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err)
os.Exit(1)
}
// Set environment variables used by kubectl so the output is consistent,
// regardless of where we run.
os.Setenv("HOME", "/home/username")
// TODO os.Stdin should really be something like ioutil.Discard, but a Reader
kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
genYaml(kubectl, "", outDir)
for _, c := range kubectl.Commands() {
genYaml(c, "kubectl", outDir)
}
}
// Temporary workaround for yaml lib generating incorrect yaml with long strings
// that do not contain \n.
func forceMultiLine(s string) string {
if len(s) > 60 && !strings.Contains(s, "\n") {
s = s + "\n"
}
return s
}
func genFlagResult(flags *pflag.FlagSet) []cmdOption {
result := make([]cmdOption, 0)
flags.VisitAll(func(flag *pflag.Flag) {
// Todo, when we mark a shorthand is deprecated, but specify an empty message.
// The flag.ShorthandDeprecated is empty as the shorthand is deprecated.
// Using len(flag.ShorthandDeprecated) > 0 can't handle this, others are ok.
if !(len(flag.ShorthandDeprecated) > 0) && len(flag.Shorthand) > 0 {
opt := cmdOption{
flag.Name,
flag.Shorthand,
flag.DefValue,
forceMultiLine(flag.Usage),
}
result = append(result, opt)
} else {
opt := cmdOption{
Name: flag.Name,
DefaultValue: forceMultiLine(flag.DefValue),
Usage: forceMultiLine(flag.Usage),
}
result = append(result, opt)
}
})
return result
}
func genYaml(command *cobra.Command, parent, docsDir string) {
doc := cmdDoc{}
doc.Name = command.Name()
doc.Synopsis = forceMultiLine(command.Short)
doc.Description = forceMultiLine(command.Long)
flags := command.NonInheritedFlags()
if flags.HasFlags() {
doc.Options = genFlagResult(flags)
}
flags = command.InheritedFlags()
if flags.HasFlags() {
doc.InheritedOptions = genFlagResult(flags)
}
if len(command.Example) > 0 {
doc.Example = command.Example
}
if len(command.Commands()) > 0 || len(parent) > 0 {
result := make([]string, 0)
if len(parent) > 0 {
result = append(result, parent)
}
for _, c := range command.Commands() {
result = append(result, c.Name())
}
doc.SeeAlso = result
}
final, err := yaml.Marshal(&doc)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var filename string
if parent == "" {
filename = docsDir + doc.Name + ".yaml"
} else {
filename = docsDir + parent + "_" + doc.Name + ".yaml"
}
outFile, err := os.Create(filename)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer outFile.Close()
_, err = outFile.Write(final)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

View File

@ -0,0 +1,98 @@
name: kubectl
synopsis: kubectl controls the Kubernetes cluster manager
description: |-
kubectl controls the Kubernetes cluster manager.
Find more information at https://github.com/kubernetes/kubernetes.
options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- get
- describe
- create
- replace
- patch
- delete
- edit
- apply
- namespace
- logs
- rolling-update
- scale
- cordon
- drain
- uncordon
- attach
- exec
- port-forward
- proxy
- run
- stop
- expose
- autoscale
- rollout
- label
- annotate
- config
- cluster-info
- api-versions
- version
- explain
- convert

View File

@ -0,0 +1,143 @@
name: annotate
synopsis: Update the annotations on a resource
description: |-
Update the annotations on one or more resources.
An annotation is a key/value pair that can hold larger (compared to a label), and possibly not human-readable, data.
It is intended to store non-identifying auxiliary data, especially data manipulated by tools and system extensions.
If --overwrite is true, then existing annotations can be overwritten, otherwise attempting to overwrite an annotation will result in an error.
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.
Possible resources include (case insensitive): pods (po), services (svc),
replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs),
limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc),
horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.
options:
- name: all
default_value: "false"
usage: |
select all resources in the namespace of the specified resource types
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to update the annotation
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: overwrite
default_value: "false"
usage: |
If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: resource-version
usage: |
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.
- name: selector
shorthand: l
usage: Selector (label query) to filter on
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
# If the same annotation is set multiple times, only the last value will be applied
kubectl annotate pods foo description='my frontend'
# Update a pod identified by type and name in "pod.json"
kubectl annotate -f pod.json description='my frontend'
# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
kubectl annotate --overwrite pods foo description='my frontend running nginx'
# Update all pods in the namespace
kubectl annotate pods --all description='my frontend running nginx'
# Update pod 'foo' only if the resource is unchanged from version 1.
kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
# Update pod 'foo' by removing an annotation named 'description' if it exists.
# Does not require the --overwrite flag.
kubectl annotate pods foo description-
see_also:
- kubectl

View File

@ -0,0 +1,64 @@
name: api-versions
synopsis: |
Print the supported API versions on the server, in the form of "group/version".
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- kubectl

View File

@ -0,0 +1,92 @@
name: apply
synopsis: Apply a configuration to a resource by filename or stdin
description: "Apply a configuration to a resource by filename or stdin.\nThe resource
will be created if it doesn't exist yet. \n\nJSON and YAML formats are accepted."
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file that contains the configuration to apply
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: schema-cache-dir
default_value: ~/.kube/schema
usage: |
If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
- name: validate
default_value: "true"
usage: |
If true, use a schema to validate the input before sending it
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Apply the configuration in pod.json to a pod.
kubectl apply -f ./pod.json
# Apply the JSON passed into stdin to a pod.
cat pod.json | kubectl apply -f -
see_also:
- kubectl

View File

@ -0,0 +1,88 @@
name: attach
synopsis: Attach to a running container.
description: |
Attach to a process that is already running inside an existing container.
options:
- name: container
shorthand: c
usage: |
Container name. If omitted, the first container in the pod will be chosen
- name: stdin
shorthand: i
default_value: "false"
usage: Pass stdin to the container
- name: tty
shorthand: t
default_value: "false"
usage: Stdin is a TTY
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Get output from running pod 123456-7890, using the first container by default
kubectl attach 123456-7890
# Get output from ruby-container from pod 123456-7890
kubectl attach 123456-7890 -c ruby-container
# Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-7890
# and sends stdout/stderr from 'bash' back to the client
kubectl attach 123456-7890 -c ruby-container -i -t
see_also:
- kubectl

View File

@ -0,0 +1,136 @@
name: autoscale
synopsis: |
Auto-scale a Deployment, ReplicaSet, or ReplicationController
description: |-
Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster.
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.
options:
- name: cpu-percent
default_value: "-1"
usage: |
The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, the server will apply a default value.
- name: dry-run
default_value: "false"
usage: |
If true, only print the object that would be sent, without creating it.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to autoscale.
- name: generator
default_value: horizontalpodautoscaler/v1beta1
usage: |
The name of the API generator to use. Currently there is only 1 generator.
- name: max
default_value: "-1"
usage: |
The upper limit for the number of pods that can be set by the autoscaler. Required.
- name: min
default_value: "-1"
usage: |
The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.
- name: name
usage: |
The name for the newly created object. If not specified, the name of the input resource will be used.
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: save-config
default_value: "false"
usage: |
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.
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Auto scale a deployment "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies:
kubectl autoscale deployment foo --min=2 --max=10
# Auto scale a replication controller "foo", with the number of pods between 1 to 5, target CPU utilization at 80%:
kubectl autoscale rc foo --max=5 --cpu-percent=80
see_also:
- kubectl

View File

@ -0,0 +1,65 @@
name: cluster-info
synopsis: Display cluster info
description: |
Display addresses of the master and services with label kubernetes.io/cluster-service=true
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- kubectl

View File

@ -0,0 +1,79 @@
name: config
synopsis: config modifies kubeconfig files
description: |
config modifies kubeconfig files using subcommands like "kubectl config set current-context my-context"
The loading order follows these rules:
1. If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.
2. 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 together. 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.
3. Otherwise, ${HOME}/.kube/config is used and no merging takes place.
options:
- name: kubeconfig
usage: use a particular kubeconfig file
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- kubectl
- view
- set-cluster
- set-credentials
- set-context
- set
- unset
- current-context
- use-context

View File

@ -0,0 +1,126 @@
name: convert
synopsis: Convert config files between different API versions
description: |
Convert config files between different API versions. Both YAML
and JSON formats are accepted.
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.
The default output will be printed to stdout in YAML format. One can use -o option
to change to output destination.
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file to need to get converted.
- name: local
default_value: "true"
usage: |
If true, convert will NOT try to contact api-server but run locally.
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: schema-cache-dir
default_value: ~/.kube/schema
usage: |
If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: validate
default_value: "true"
usage: |
If true, use a schema to validate the input before sending it
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |
# Convert 'pod.yaml' to latest version and print to stdout.
kubectl convert -f pod.yaml
# Convert the live state of the resource specified by 'pod.yaml' to the latest version
# and print to stdout in json format.
kubectl convert -f pod.yaml --local -o json
# Convert all files under current directory to latest version and create them all.
kubectl convert -f . | kubectl create -f -
see_also:
- kubectl

View File

@ -0,0 +1,68 @@
name: cordon
synopsis: Mark node as unschedulable
description: |
Mark node as unschedulable.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |
# Mark node "foo" as unschedulable.
kubectl cordon foo
see_also:
- kubectl

View File

@ -0,0 +1,102 @@
name: create
synopsis: Create a resource by filename or stdin
description: |-
Create a resource by filename or stdin.
JSON and YAML formats are accepted.
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file to use to create the resource
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: save-config
default_value: "false"
usage: |
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.
- name: schema-cache-dir
default_value: ~/.kube/schema
usage: |
If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
- name: validate
default_value: "true"
usage: |
If true, use a schema to validate the input before sending it
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Create a pod using the data in pod.json.
kubectl create -f ./pod.json
# Create a pod based on the JSON passed into stdin.
cat pod.json | kubectl create -f -
see_also:
- kubectl
- namespace
- secret
- configmap
- serviceaccount

View File

@ -0,0 +1,124 @@
name: delete
synopsis: |
Delete resources by filenames, stdin, resources and names, or by resources and label selector.
description: |-
Delete resources by filenames, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted.
Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector
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.
options:
- name: all
default_value: "false"
usage: '[-all] to select all the specified resources.'
- name: cascade
default_value: "true"
usage: |
If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file containing the resource to delete.
- name: grace-period
default_value: "-1"
usage: |
Period of time in seconds given to the resource to terminate gracefully. Ignored if negative.
- name: ignore-not-found
default_value: "false"
usage: |
Treat "resource not found" as a successful delete. Defaults to "true" when --all is specified.
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: selector
shorthand: l
usage: Selector (label query) to filter on.
- name: timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Delete a pod using the type and name specified in pod.json.
kubectl delete -f ./pod.json
# Delete a pod based on the type and name in the JSON passed into stdin.
cat pod.json | kubectl delete -f -
# Delete pods and services with same names "baz" and "foo"
kubectl delete pod,service baz foo
# Delete pods and services with label name=myLabel.
kubectl delete pods,services -l name=myLabel
# Delete a pod with UID 1234-56-7890-234234-456456.
kubectl delete pod 1234-56-7890-234234-456456
# Delete all pods
kubectl delete pods --all
see_also:
- kubectl

View File

@ -0,0 +1,107 @@
name: describe
synopsis: Show details of a specific resource or group of resources
description: |-
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.
$ kubectl describe TYPE NAME_PREFIX
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
Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts, ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file containing the resource to describe
- name: selector
shorthand: l
usage: Selector (label query) to filter on
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Describe a node
kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
# Describe a pod
kubectl describe pods/nginx
# Describe a pod identified by type and name in "pod.json"
kubectl describe -f pod.json
# Describe all pods
kubectl describe pods
# Describe pods by label name=myLabel
kubectl describe po -l name=myLabel
# Describe all pods managed by the 'frontend' replication controller (rc-created pods
# get the name of the rc as a prefix in the pod the name).
kubectl describe pods frontend
see_also:
- kubectl

View File

@ -0,0 +1,95 @@
name: drain
synopsis: Drain node in preparation for maintenance
description: |
Drain node in preparation for maintenance.
The given node will be marked unschedulable to prevent new pods from arriving.
Then drain 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,
DaemonSet or Job--, then drain will not delete any pods unless you use --force.
When you are ready to put the node back into service, use kubectl uncordon, which
will make the node schedulable again.
options:
- name: force
default_value: "false"
usage: |
Continue even if there are pods not managed by a ReplicationController, Job, or DaemonSet.
- name: grace-period
default_value: "-1"
usage: |
Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.
- name: ignore-daemonsets
default_value: "false"
usage: Ignore DaemonSet-managed pods.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |
# Drain node "foo", even if there are pods not managed by a ReplicationController, Job, or DaemonSet on it.
$ kubectl drain foo --force
# As above, but abort if there are pods not managed by a ReplicationController, Job, or DaemonSet, and use a grace period of 15 minutes.
$ kubectl drain foo --grace-period=900
see_also:
- kubectl

View File

@ -0,0 +1,115 @@
name: edit
synopsis: Edit a resource on the server
description: |-
Edit a resource from the default editor.
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 'vi' for Linux or 'notepad' 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.
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.
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.
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file to use to edit the resource
- name: output
shorthand: o
default_value: yaml
usage: 'Output format. One of: yaml|json.'
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: save-config
default_value: "false"
usage: |
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.
- name: windows-line-endings
default_value: "false"
usage: Use Windows line-endings (default Unix line-endings)
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |2-
# Edit the service named 'docker-registry':
kubectl edit svc/docker-registry
# Use an alternative editor
KUBE_EDITOR="nano" kubectl edit svc/docker-registry
# Edit the service 'docker-registry' in JSON using the v1 API format:
kubectl edit svc/docker-registry --output-version=v1 -o json
see_also:
- kubectl

View File

@ -0,0 +1,86 @@
name: exec
synopsis: Execute a command in a container.
description: Execute a command in a container.
options:
- name: container
shorthand: c
usage: |
Container name. If omitted, the first container in the pod will be chosen
- name: pod
shorthand: p
usage: Pod name
- name: stdin
shorthand: i
default_value: "false"
usage: Pass stdin to the container
- name: tty
shorthand: t
default_value: "false"
usage: Stdin is a TTY
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: "# Get output from running 'date' from pod 123456-7890, using the first container
by default\nkubectl exec 123456-7890 date\n\t\n# Get output from running 'date'
in ruby-container from pod 123456-7890\nkubectl exec 123456-7890 -c ruby-container
date\n\n# Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from
pod 123456-7890\n# and sends stdout/stderr from 'bash' back to the client\nkubectl
exec 123456-7890 -c ruby-container -i -t -- bash -il"
see_also:
- kubectl

View File

@ -0,0 +1,81 @@
name: explain
synopsis: Documentation of resources.
description: |-
Documentation of resources.
Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts, ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.
options:
- name: recursive
default_value: "false"
usage: Print the fields of fields (Currently only 1 level deep)
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Get the documentation of the resource and its fields
kubectl explain pods
# Get the documentation of a specific field of a resource
kubectl explain pods.spec.containers
see_also:
- kubectl

View File

@ -0,0 +1,179 @@
name: expose
synopsis: |
Take a replication controller, service, or pod and expose it as a new Kubernetes Service
description: "Take a deployment, service, replica set, replication controller, or
pod and expose it as a new Kubernetes service.\n\nLooks up a deployment, service,
replica set, replication controller or pod by name and uses the selector\nfor that
resource as the selector for a new service on the specified port. A deployment or
replica set\nwill be exposed as a service only if its selector is convertible to
a selector that service supports,\ni.e. when the selector contains only the matchLabels
component. Note that if no port is specified via\n--port and the exposed resource
has multiple ports, all will be re-used by the new service. Also if no \nlabels
are specified, the new service will re-use the labels from the resource it exposes."
options:
- name: container-port
usage: Synonym for --target-port
- name: create-external-load-balancer
default_value: "false"
usage: |
If true, create an external load balancer for this service (trumped by --type). Implementation is cloud provider dependent. Default is 'false'.
- name: dry-run
default_value: "false"
usage: |
If true, only print the object that would be sent, without creating it.
- name: external-ip
usage: |
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.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to expose a service
- name: generator
default_value: service/v2
usage: |
The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'.
- name: labels
shorthand: l
usage: Labels to apply to the service created by this call.
- name: load-balancer-ip
usage: |
IP to assign to to the Load Balancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).
- name: name
usage: The name for the newly created object.
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: overrides
usage: |
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.
- name: port
usage: |
The port that the service should serve on. Copied from the resource being exposed, if unspecified
- name: protocol
default_value: TCP
usage: |
The network protocol for the service to be created. Default is 'tcp'.
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: save-config
default_value: "false"
usage: |
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.
- name: selector
usage: |
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.
- name: session-affinity
usage: |
If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: target-port
usage: |
Name or number for the port on the container that the service should direct traffic to. Optional.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: type
usage: |
Type for this service: ClusterIP, NodePort, or LoadBalancer. Default is 'ClusterIP'.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
kubectl expose rc nginx --port=80 --target-port=8000
# Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000.
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
# Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
kubectl expose pod valid-pod --port=444 --name=frontend
# Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
# Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.
kubectl expose rs nginx --port=80 --target-port=8000
# Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.
kubectl expose deployment nginx --port=80 --target-port=8000
see_also:
- kubectl

View File

@ -0,0 +1,154 @@
name: get
synopsis: Display one or many resources
description: |-
Display one or many resources.
Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts, ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.
By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).
options:
- name: all-namespaces
default_value: "false"
usage: |
If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
- name: export
default_value: "false"
usage: |
If true, use 'export' for the resources. Exported resources are stripped of cluster-specific information.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to get from a server.
- name: label-columns
shorthand: L
default_value: '[]'
usage: |
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 statements like -L label1 -L label2...
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: selector
shorthand: l
usage: Selector (label query) to filter on
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: watch
shorthand: w
default_value: "false"
usage: |
After listing/getting the requested object, watch for changes.
- name: watch-only
default_value: "false"
usage: |
Watch for changes to the requested object(s), without listing/getting first.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# List all pods in ps output format.
kubectl get pods
# List all pods in ps output format with more information (such as node name).
kubectl get pods -o wide
# List a single replication controller with specified NAME in ps output format.
kubectl get replicationcontroller web
# List a single pod in JSON output format.
kubectl get -o json pod web-pod-13je7
# List a pod identified by type and name specified in "pod.yaml" in JSON output format.
kubectl get -f pod.yaml -o json
# Return only the phase value of the specified pod.
kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
# List all replication controllers and services together in ps output format.
kubectl get rc,services
# List one or more resources by their type and names.
kubectl get rc/web service/frontend pods/web-pod-13je7
see_also:
- kubectl

View File

@ -0,0 +1,140 @@
name: label
synopsis: Update the labels on a resource
description: |-
Update the labels on a resource.
A label must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters.
If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error.
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.
options:
- name: all
default_value: "false"
usage: |
select all resources in the namespace of the specified resource types
- name: dry-run
default_value: "false"
usage: |
If true, only print the object that would be sent, without sending it.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to update the labels
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: overwrite
default_value: "false"
usage: |
If true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels.
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: resource-version
usage: |
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.
- name: selector
shorthand: l
usage: Selector (label query) to filter on
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Update pod 'foo' with the label 'unhealthy' and the value 'true'.
kubectl label pods foo unhealthy=true
# Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
kubectl label --overwrite pods foo status=unhealthy
# Update all pods in the namespace
kubectl label pods --all status=unhealthy
# Update a pod identified by the type and name in "pod.json"
kubectl label -f pod.json status=unhealthy
# Update pod 'foo' only if the resource is unchanged from version 1.
kubectl label pods foo status=unhealthy --resource-version=1
# Update pod 'foo' by removing a label named 'bar' if it exists.
# Does not require the --overwrite flag.
kubectl label pods foo bar-
see_also:
- kubectl

View File

@ -0,0 +1,113 @@
name: logs
synopsis: Print the logs for a container in a pod.
description: |
Print the logs for a container in a pod. If the pod has only one container, the container name is optional.
options:
- name: container
shorthand: c
usage: Print the logs of this container
- name: follow
shorthand: f
default_value: "false"
usage: Specify if the logs should be streamed.
- name: interactive
default_value: "false"
usage: If true, prompt the user for input when required.
- name: limit-bytes
default_value: "0"
usage: Maximum bytes of logs to return. Defaults to no limit.
- name: previous
shorthand: p
default_value: "false"
usage: |
If true, print the logs for the previous instance of the container in a pod if it exists.
- name: since
default_value: "0"
usage: |
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.
- name: since-time
usage: |
Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.
- name: tail
default_value: "-1"
usage: |
Lines of recent log file to display. Defaults to -1, showing all log lines.
- name: timestamps
default_value: "false"
usage: Include timestamps on each line in the log output
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Return snapshot logs from pod nginx with only one container
kubectl logs nginx
# Return snapshot of previous terminated ruby container logs from pod web-1
kubectl logs -p -c ruby web-1
# Begin streaming the logs of the ruby container in pod web-1
kubectl logs -f -c ruby web-1
# Display only the most recent 20 lines of output in pod nginx
kubectl logs --tail=20 nginx
# Show all logs from pod nginx written in the last hour
kubectl logs --since=1h nginx
see_also:
- kubectl

View File

@ -0,0 +1,67 @@
name: namespace
synopsis: 'SUPERSEDED: Set and view the current Kubernetes namespace'
description: |
SUPERSEDED: Set and view the current Kubernetes namespace scope for command line requests.
namespace has been superseded by the context.namespace field of .kubeconfig files. See 'kubectl config set-context --help' for more details.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- kubectl

View File

@ -0,0 +1,102 @@
name: patch
synopsis: Update field(s) of a resource using strategic merge patch.
description: |-
Update field(s) of a resource using strategic merge patch
JSON and YAML formats are accepted.
Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html to find if a field is mutable.
options:
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to update
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: patch
shorthand: p
usage: The patch to be applied to the resource JSON file.
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: type
default_value: strategic
usage: |
The type of patch being provided; one of [json merge strategic]
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |2-
# Partially update a node using strategic merge patch
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
# Partially update a node identified by the type and name specified in "node.json" using strategic merge patch
kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
# Update a container's image; spec.containers[*].name is required because it's a merge key
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
# Update a container's image using a json patch with positional arrays
kubectl patch pod valid-pod -type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
see_also:
- kubectl

View File

@ -0,0 +1,81 @@
name: port-forward
synopsis: Forward one or more local ports to a pod.
description: Forward one or more local ports to a pod.
options:
- name: pod
shorthand: p
usage: Pod name
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |2-
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
kubectl port-forward mypod 5000 6000
# Listen on port 8888 locally, forwarding to 5000 in the pod
kubectl port-forward mypod 8888:5000
# Listen on a random port locally, forwarding to 5000 in the pod
kubectl port-forward mypod :5000
# Listen on a random port locally, forwarding to 5000 in the pod
kubectl port-forward mypod 0:5000
see_also:
- kubectl

View File

@ -0,0 +1,131 @@
name: proxy
synopsis: Run a proxy to the Kubernetes API server
description: |
To proxy all of the kubernetes api and nothing else, use:
kubectl proxy --api-prefix=/
To proxy only part of the kubernetes api and also some static files:
kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/
The above lets you 'curl localhost:8001/api/v1/pods'.
To proxy the entire kubernetes api at a different root, use:
kubectl proxy --api-prefix=/custom/
The above lets you 'curl localhost:8001/custom/api/v1/pods'
options:
- name: accept-hosts
default_value: ^localhost$,^127\.0\.0\.1$,^\[::1\]$
usage: Regular expression for hosts that the proxy should accept.
- name: accept-paths
default_value: ^/.*
usage: Regular expression for paths that the proxy should accept.
- name: address
default_value: 127.0.0.1
usage: The IP address on which to serve on.
- name: api-prefix
default_value: /
usage: Prefix to serve the proxied API under.
- name: disable-filter
default_value: "false"
usage: |
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.
- name: port
shorthand: p
default_value: "8001"
usage: |
The port on which to run the proxy. Set to 0 to pick a random port.
- name: reject-methods
default_value: POST,PUT,PATCH
usage: |
Regular expression for HTTP methods that the proxy should reject.
- name: reject-paths
default_value: ^/api/.*/exec,^/api/.*/run,^/api/.*/attach
usage: Regular expression for paths that the proxy should reject.
- name: unix-socket
shorthand: u
usage: Unix socket on which to run the proxy.
- name: www
shorthand: w
usage: |
Also serve static files from the given directory under the specified prefix.
- name: www-prefix
shorthand: P
default_value: /static/
usage: |
Prefix to serve static files under, if static file directory is specified.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
kubectl proxy --port=8011 --www=./local/www/
# Run a proxy to kubernetes apiserver on an arbitrary local port.
# The chosen port for the server will be output to stdout.
kubectl proxy --port=0
# 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/
kubectl proxy --api-prefix=/k8s-api
see_also:
- kubectl

View File

@ -0,0 +1,123 @@
name: replace
synopsis: Replace a resource by filename or stdin.
description: |-
Replace a resource by filename or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the
complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html to find if a field is mutable.
options:
- name: cascade
default_value: "false"
usage: |
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).
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file to use to replace the resource.
- name: force
default_value: "false"
usage: Delete and re-create the specified resource
- name: grace-period
default_value: "-1"
usage: |
Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: save-config
default_value: "false"
usage: |
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.
- name: schema-cache-dir
default_value: ~/.kube/schema
usage: |
If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
- name: timeout
default_value: "0"
usage: |
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
- name: validate
default_value: "true"
usage: |
If true, use a schema to validate the input before sending it
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Replace a pod using the data in pod.json.
kubectl replace -f ./pod.json
# Replace a pod based on the JSON passed into stdin.
cat pod.json | kubectl replace -f -
# Update a single-container pod's image version (tag) to v4
kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
# Force replace, delete and then re-create the resource
kubectl replace --force -f ./pod.json
see_also:
- kubectl

View File

@ -0,0 +1,154 @@
name: rolling-update
synopsis: Perform a rolling update of the given ReplicationController.
description: |-
Perform a rolling update of the given ReplicationController.
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.
options:
- name: container
usage: |
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
- name: deployment-label-key
default_value: deployment
usage: |
The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise
- name: dry-run
default_value: "false"
usage: |
If true, print out the changes that would be made, but don't actually make them.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename or URL to file to use to create the new replication controller.
- name: image
usage: |
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
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: poll-interval
default_value: 3s
usage: "Time delay between polling for replication controller status after the update.
Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".\n"
- name: rollback
default_value: "false"
usage: |
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
- name: schema-cache-dir
default_value: ~/.kube/schema
usage: |
If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: timeout
default_value: 5m0s
usage: "Max time to wait for a replication controller to update before giving up.
Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".\n"
- name: update-period
default_value: 1m0s
usage: "Time to wait between updating pods. Valid time units are \"ns\", \"us\"
(or \"µs\"), \"ms\", \"s\", \"m\", \"h\".\n"
- name: validate
default_value: "true"
usage: |
If true, use a schema to validate the input before sending it
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |
# Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
kubectl rolling-update frontend-v1 -f frontend-v2.json
# Update pods of frontend-v1 using JSON data passed into stdin.
cat frontend-v2.json | kubectl rolling-update frontend-v1 -f -
# Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the
# name of the replication controller.
kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2
# Update the pods of frontend by just changing the image, and keeping the old name.
kubectl rolling-update frontend --image=image:v2
# Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2).
kubectl rolling-update frontend-v1 frontend-v2 --rollback
see_also:
- kubectl

View File

@ -0,0 +1,72 @@
name: rollout
synopsis: rollout manages a deployment
description: |
Manages a deployment using subcommands like "kubectl rollout undo deployment/abc"
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Rollback to the previous deployment
kubectl rollout undo deployment/abc
see_also:
- kubectl
- history
- pause
- resume
- undo

View File

@ -0,0 +1,195 @@
name: run
synopsis: Run a particular image on the cluster.
description: |-
Create and run a particular image, possibly replicated.
Creates a deployment or job to manage the created container(s).
options:
- name: attach
default_value: "false"
usage: |
If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.
- name: command
default_value: "false"
usage: |
If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.
- name: dry-run
default_value: "false"
usage: |
If true, only print the object that would be sent, without sending it.
- name: env
default_value: '[]'
usage: Environment variables to set in the container
- name: expose
default_value: "false"
usage: |
If true, a public, external service is created for the container(s) which are run
- name: generator
usage: |
The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1'. This will happen only for cluster version at least 1.2, for olders we will fallback to 'run/v1' for --restart=Always, 'run-pod/v1' for others.
- name: hostport
default_value: "-1"
usage: |
The host port mapping for the container port. To demonstrate a single-machine container.
- name: image
usage: The image for the container to run.
- name: labels
shorthand: l
usage: Labels to apply to the pod(s).
- name: leave-stdin-open
default_value: "false"
usage: |
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.
- name: limits
usage: |
The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'
- name: no-headers
default_value: "false"
usage: When using the default output, don't print headers.
- name: output
shorthand: o
usage: |
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
- name: output-version
usage: |
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
- name: overrides
usage: |
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.
- name: port
default_value: "-1"
usage: |
The port that this container exposes. If --expose is true, this is also the port used by the service that is created.
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: replicas
shorthand: r
default_value: "1"
usage: |
Number of replicas to create for this container. Default is 1.
- name: requests
usage: |
The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'
- name: restart
default_value: Always
usage: |
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
- name: rm
default_value: "false"
usage: |
If true, delete resources created in this command for attached containers.
- name: save-config
default_value: "false"
usage: |
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.
- name: service-generator
default_value: service/v2
usage: |
The name of the generator to use for creating a service. Only used if --expose is true
- name: service-overrides
usage: |
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.
- name: show-all
shorthand: a
default_value: "false"
usage: |
When printing, show all resources (default hide terminated pods.)
- name: show-labels
default_value: "false"
usage: |
When printing, show all labels as the last column (default hide labels column)
- name: sort-by
usage: |
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
- name: stdin
shorthand: i
default_value: "false"
usage: |
Keep stdin open on the container(s) in the pod, even if nothing is attached.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: tty
default_value: "false"
usage: |
Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: "# Start a single instance of nginx.\nkubectl run nginx --image=nginx\n\n#
Start a single instance of hazelcast and let the container expose port 5701 .\nkubectl
run hazelcast --image=hazelcast --port=5701\n\n# Start a single instance of hazelcast
and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\"
in the container.\nkubectl run hazelcast --image=hazelcast --env=\"DNS_DOMAIN=cluster\"
--env=\"POD_NAMESPACE=default\"\n\n# Start a replicated instance of nginx.\nkubectl
run nginx --image=nginx --replicas=5\n\n# Dry run. Print the corresponding API objects
without creating them.\nkubectl run nginx --image=nginx --dry-run\n\n# Start a single
instance of nginx, but overload the spec of the deployment with a partial set of
values parsed from JSON.\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\":
\"v1\", \"spec\": { ... } }'\n\n# Start a single instance of busybox and keep it
in the foreground, don't restart it if it exits.\nkubectl run -i --tty busybox --image=busybox
--restart=Never\n\n# Start the nginx container using the default command, but use
custom arguments (arg1 .. argN) for that command.\nkubectl run nginx --image=nginx
-- <arg1> <arg2> ... <argN>\n\n# Start the nginx container using a different command
and custom arguments.\nkubectl run nginx --image=nginx --command -- <cmd> <arg1>
... <argN>\n\n# Start the perl container to compute π to 2000 places and print it
out.\nkubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle
'print bpi(2000)'"
see_also:
- kubectl

View File

@ -0,0 +1,113 @@
name: scale
synopsis: |
Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
description: |-
Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
Scale also allows users to specify one or more preconditions for the scale action.
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.
options:
- name: current-replicas
default_value: "-1"
usage: |
Precondition for current size. Requires that the current size of the resource match this value in order to scale.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to a file identifying the resource to set a new size
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: record
default_value: "false"
usage: Record current kubectl command in the resource annotation.
- name: replicas
default_value: "-1"
usage: The new desired number of replicas. Required.
- name: resource-version
usage: |
Precondition for resource version. Requires that the current resource version match this value in order to scale.
- name: timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a scale operation, zero means don't wait.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Scale a replicaset named 'foo' to 3.
kubectl scale --replicas=3 rs/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3.
kubectl scale --replicas=3 -f foo.yaml
# If the deployment named mysql's current size is 2, scale mysql to 3.
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
# Scale multiple replication controllers.
kubectl scale --replicas=5 rc/foo rc/bar rc/baz
# Scale job named 'cron' to 3.
kubectl scale --replicas=3 job/cron
see_also:
- kubectl

View File

@ -0,0 +1,111 @@
name: stop
synopsis: |
Deprecated: Gracefully shut down a resource by name or filename.
description: |-
Deprecated: Gracefully shut down a resource by name or filename.
The stop command is deprecated, all its functionalities are covered by delete command.
See 'kubectl delete --help' for more details.
Attempts to shut down and delete a resource that supports graceful termination.
If the resource is scalable it will be scaled to 0 before deletion.
options:
- name: all
default_value: "false"
usage: '[-all] to select all the specified resources.'
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to file of resource(s) to be stopped.
- name: grace-period
default_value: "-1"
usage: |
Period of time in seconds given to the resource to terminate gracefully. Ignored if negative.
- name: ignore-not-found
default_value: "false"
usage: Treat "resource not found" as a successful stop.
- name: output
shorthand: o
usage: |
Output mode. Use "-o name" for shorter output (resource/name).
- name: selector
shorthand: l
usage: Selector (label query) to filter on.
- name: timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |-
# Shut down foo.
kubectl stop replicationcontroller foo
# Stop pods and services with label name=myLabel.
kubectl stop pods,services -l name=myLabel
# Shut down the service defined in service.json
kubectl stop -f service.json
# Shut down all resources in the path/to/resources directory
kubectl stop -f path/to/resources
see_also:
- kubectl

View File

@ -0,0 +1,68 @@
name: uncordon
synopsis: Mark node as schedulable
description: |
Mark node as schedulable.
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
example: |
# Mark node "foo" as schedulable.
$ kubectl uncordon foo
see_also:
- kubectl

View File

@ -0,0 +1,67 @@
name: version
synopsis: Print the client and server version information.
options:
- name: client
default_value: "false"
usage: Client version only (no server required).
inherited_options:
- name: alsologtostderr
default_value: "false"
usage: log to standard error as well as files
- name: api-version
usage: |
DEPRECATED: The API version to use when talking to the server
- name: certificate-authority
usage: Path to a cert. file for the certificate authority.
- name: client-certificate
usage: Path to a client certificate file for TLS.
- name: client-key
usage: Path to a client key file for TLS.
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: log-backtrace-at
default_value: :0
usage: when logging hits line file:N, emit a stack trace
- name: log-dir
usage: If non-empty, write log files in this directory
- name: log-flush-frequency
default_value: 5s
usage: Maximum number of seconds between log flushes
- name: logtostderr
default_value: "true"
usage: log to standard error instead of files
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
usage: If present, the namespace scope for this CLI request.
- name: password
usage: Password for basic authentication to the API server.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: stderrthreshold
default_value: "2"
usage: logs at or above this threshold go to stderr
- name: token
usage: Bearer token for authentication to the API server.
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server.
- name: v
default_value: "0"
usage: log level for V logs
- name: vmodule
usage: |
comma-separated list of pattern=N settings for file-filtered logging
see_also:
- kubectl