diff --git a/cmd/gendocs/gen_kubectl_docs.go b/cmd/gendocs/gen_kubectl_docs.go index e8d2ec72183af..a0fee8d2b8f59 100644 --- a/cmd/gendocs/gen_kubectl_docs.go +++ b/cmd/gendocs/gen_kubectl_docs.go @@ -65,10 +65,10 @@ func genMarkdown(command *cobra.Command, parent, docsDir string) { fmt.Fprintf(out, "## %s\n\n", name) fmt.Fprintf(out, "%s\n\n", short) fmt.Fprintf(out, "### Synopsis\n\n") - fmt.Fprintf(out, "```\n%s\n```\n\n", long) + fmt.Fprintf(out, "\n%s\n\n", long) if command.Runnable() { - fmt.Fprintf(out, "%s\n\n", command.UseLine()) + fmt.Fprintf(out, "```\n%s\n```\n\n", command.UseLine()) } if len(command.Example) > 0 { diff --git a/docs/kubectl-clusterinfo.md b/docs/kubectl-clusterinfo.md index 3677e6723c11c..8b5bfff601729 100644 --- a/docs/kubectl-clusterinfo.md +++ b/docs/kubectl-clusterinfo.md @@ -4,11 +4,12 @@ Display cluster info ### Synopsis -``` + Display addresses of the master and services with label kubernetes.io/cluster-service=true -``` +``` kubectl clusterinfo +``` ### Options inherrited from parent commands diff --git a/docs/kubectl-config-set-cluster.md b/docs/kubectl-config-set-cluster.md index 2138d6d5dac0b..106e7203a54a3 100644 --- a/docs/kubectl-config-set-cluster.md +++ b/docs/kubectl-config-set-cluster.md @@ -4,16 +4,26 @@ Sets a cluster entry in .kubeconfig ### Synopsis + +Sets a cluster entry in .kubeconfig. +Specifying a name that already exists will merge new fields on top of existing values for those fields. + ``` -Sets a cluster entry in .kubeconfig - Specifying a name that already exists will merge new fields on top of existing values for those fields. - e.g. - kubectl config set-cluster e2e --certificate-authority=~/.kube/e2e/.kubernetes.ca.cert - only sets the certificate-authority field on the e2e cluster entry without touching other values. - +kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certficate/authority] [--api-version=apiversion] [--insecure-skip-tls-verify=true] +``` + +### Examples + ``` +// Set only the server field on the e2e cluster entry without touching other values. +$ kubectl config set-cluster e2e --server=https://1.2.3.4 -kubectl config set-cluster name [--server=server] [--certificate-authority=path/to/certficate/authority] [--api-version=apiversion] [--insecure-skip-tls-verify=true] +// Embed certificate authority data for the e2e cluster entry +$ kubectl config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt + +// Disable cert checking for the dev cluster entry +$ kubectl config set-cluster e2e --insecure-skip-tls-verify=true +``` ### Options diff --git a/docs/kubectl-config-set-context.md b/docs/kubectl-config-set-context.md index b68f357c4c137..9e4e3062c7cd8 100644 --- a/docs/kubectl-config-set-context.md +++ b/docs/kubectl-config-set-context.md @@ -4,15 +4,20 @@ Sets a context entry in .kubeconfig ### Synopsis -``` + Sets a context entry in .kubeconfig - Specifying a name that already exists will merge new fields on top of existing values for those fields. - e.g. - kubectl config set-context gce --user=cluster-admin - only sets the user field on the gce context entry without touching other values. +Specifying a name that already exists will merge new fields on top of existing values for those fields. + +``` +kubectl config set-context NAME [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] ``` -kubectl config set-context name [--cluster=cluster-nickname] [--user=user-nickname] [--namespace=namespace] +### Examples + +``` +// Set the user field on the gce context entry without touching other values +$ kubectl config set-context gce --user=cluster-admin +``` ### Options inherrited from parent commands diff --git a/docs/kubectl-config-set-credentials.md b/docs/kubectl-config-set-credentials.md index 0c23a4f020429..a956753902eef 100644 --- a/docs/kubectl-config-set-credentials.md +++ b/docs/kubectl-config-set-credentials.md @@ -4,14 +4,9 @@ Sets a user entry in .kubeconfig ### Synopsis -``` -Sets a user entry in .kubeconfig - - Specifying a name that already exists will merge new fields on top of existing - values. For example, the following only sets the "client-key" field on the - "cluster-admin" entry, without touching other values: - set-credentials cluster-admin --client-key=~/.kube/admin.key +Sets a user entry in .kubeconfig +Specifying a name that already exists will merge new fields on top of existing values. Client-certificate flags: --client-certificate=certfile --client-key=keyfile @@ -24,9 +19,24 @@ Sets a user entry in .kubeconfig Bearer token and basic auth are mutually exclusive. + +``` +kubectl config set-credentials NAME [--auth-path=/path/to/authfile] [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] ``` -kubectl config set-credentials name [--auth-path=authfile] [--client-certificate=certfile] [--client-key=keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] +### Examples + +``` +// Set only the "client-key" field on the "cluster-admin" +// entry, without touching other values: +$ kubectl set-credentials cluster-admin --client-key=~/.kube/admin.key + +// Set basic auth for the "cluster-admin" entry +$ kubectl set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif + +// Embed client certificate data in the "cluster-admin" entry +$ kubectl set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true +``` ### Options diff --git a/docs/kubectl-config-set.md b/docs/kubectl-config-set.md index dd86268e84986..1be356a5cb43d 100644 --- a/docs/kubectl-config-set.md +++ b/docs/kubectl-config-set.md @@ -4,16 +4,14 @@ Sets an individual value in a .kubeconfig file ### Synopsis -``` -Sets an individual value in a .kubeconfig file - property-name is a dot delimited name where each token represents either a attribute name or a map key. Map keys may not contain dots. - property-value is the new value you wish to set. +Sets an individual value in a .kubeconfig file +PROPERTY_NAME is a dot delimited name where each token represents either a attribute name or a map key. Map keys may not contain dots. +PROPERTY_VALUE is the new value you wish to set. - ``` - -kubectl config set property-name property-value +kubectl config set PROPERTY_NAME PROPERTY_VALUE +``` ### Options inherrited from parent commands diff --git a/docs/kubectl-config-unset.md b/docs/kubectl-config-unset.md index 72b00656a0b84..3e327de079004 100644 --- a/docs/kubectl-config-unset.md +++ b/docs/kubectl-config-unset.md @@ -4,14 +4,13 @@ Unsets an individual value in a .kubeconfig file ### Synopsis -``` + Unsets an individual value in a .kubeconfig file +PROPERTY_NAME is a dot delimited name where each token represents either a attribute name or a map key. Map keys may not contain dots. - property-name is a dot delimited name where each token represents either a attribute name or a map key. Map keys may not contain dots. - ``` - -kubectl config unset property-name +kubectl config unset PROPERTY_NAME +``` ### Options inherrited from parent commands diff --git a/docs/kubectl-config-use-context.md b/docs/kubectl-config-use-context.md index 8b152554b3894..11f6e0f7b8825 100644 --- a/docs/kubectl-config-use-context.md +++ b/docs/kubectl-config-use-context.md @@ -4,11 +4,12 @@ Sets the current-context in a .kubeconfig file ### Synopsis -``` + Sets the current-context in a .kubeconfig file -``` -kubectl config use-context context-name +``` +kubectl config use-context CONTEXT_NAME +``` ### Options inherrited from parent commands diff --git a/docs/kubectl-config-view.md b/docs/kubectl-config-view.md index 037bb63795aee..dd50f1eab8191 100644 --- a/docs/kubectl-config-view.md +++ b/docs/kubectl-config-view.md @@ -4,11 +4,14 @@ displays merged .kubeconfig settings or a specified .kubeconfig file. ### Synopsis -``` + displays merged .kubeconfig settings or a specified .kubeconfig file. -``` +You can use --output=template --template=TEMPLATE to extract specific values. + +``` kubectl config view +``` ### Examples @@ -18,6 +21,9 @@ $ kubectl config view // Show only local ./.kubeconfig settings $ kubectl config view --local + +// Get the password for the e2e user +$ kubectl config view -o template --template='{{ index . "users" "e2e" "password" }}' ``` ### Options diff --git a/docs/kubectl-config.md b/docs/kubectl-config.md index aac77726be740..56cef264f0b18 100644 --- a/docs/kubectl-config.md +++ b/docs/kubectl-config.md @@ -4,11 +4,12 @@ config modifies .kubeconfig files ### Synopsis -``` + config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context" -``` -kubectl config +``` +kubectl config SUBCOMMAND +``` ### Options diff --git a/docs/kubectl-create.md b/docs/kubectl-create.md index 63e08787add45..52f8ea32fba93 100644 --- a/docs/kubectl-create.md +++ b/docs/kubectl-create.md @@ -4,13 +4,14 @@ Create a resource by filename or stdin ### Synopsis -``` + Create a resource by filename or stdin. JSON and YAML formats are accepted. -``` -kubectl create -f filename +``` +kubectl create -f FILENAME +``` ### Examples diff --git a/docs/kubectl-delete.md b/docs/kubectl-delete.md index 7fa55933b1486..c92da2baeeaa3 100644 --- a/docs/kubectl-delete.md +++ b/docs/kubectl-delete.md @@ -4,7 +4,7 @@ Delete a resource by filename, stdin, or resource and ID. ### Synopsis -``` + Delete a resource by filename, stdin, resource and ID, or by resources and label selector. JSON and YAML formats are accepted. @@ -15,9 +15,10 @@ arguments are used and the filename is ignored. 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. -``` -kubectl delete (-f filename | ( | -l