Use bash comments in kubectl examples
Comments in kubectl examples should use bash comments, not Go comments. So, replaces // by # for example strings.
This commit is contained in:
@@ -33,14 +33,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
attach_example = `// get output from running pod 123456-7890, using the first container by default
|
||||
attach_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
|
||||
|
||||
# get output from ruby-container from pod 123456-7890
|
||||
$ kubectl attach 123456-7890 -c ruby-container date
|
||||
|
||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
||||
// and sends stdout/stderr from 'bash' back to the client
|
||||
# switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
||||
# and sends stdout/stderr from 'bash' back to the client
|
||||
$ kubectl attach 123456-7890 -c ruby-container -i -t`
|
||||
)
|
||||
|
||||
|
@@ -58,14 +58,14 @@ Specifying a name that already exists will merge new fields on top of existing v
|
||||
Bearer token and basic auth are mutually exclusive.
|
||||
`, clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword)
|
||||
|
||||
const create_authinfo_example = `// Set only the "client-key" field on the "cluster-admin"
|
||||
// entry, without touching other values:
|
||||
const create_authinfo_example = `# Set only the "client-key" field on the "cluster-admin"
|
||||
# entry, without touching other values:
|
||||
$ kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key
|
||||
|
||||
// Set basic auth for the "cluster-admin" entry
|
||||
# Set basic auth for the "cluster-admin" entry
|
||||
$ kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
|
||||
|
||||
// Embed client certificate data in the "cluster-admin" entry
|
||||
# Embed client certificate data in the "cluster-admin" entry
|
||||
$ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true`
|
||||
|
||||
func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Command {
|
||||
|
@@ -43,13 +43,13 @@ type createClusterOptions struct {
|
||||
const (
|
||||
create_cluster_long = `Sets a cluster entry in kubeconfig.
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`
|
||||
create_cluster_example = `// Set only the server field on the e2e cluster entry without touching other values.
|
||||
create_cluster_example = `# 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
|
||||
|
||||
// Embed certificate authority data for the e2e cluster entry
|
||||
# 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
|
||||
# Disable cert checking for the dev cluster entry
|
||||
$ kubectl config set-cluster e2e --insecure-skip-tls-verify=true`
|
||||
)
|
||||
|
||||
|
@@ -39,7 +39,7 @@ type createContextOptions struct {
|
||||
const (
|
||||
create_context_long = `Sets a context entry in kubeconfig
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`
|
||||
create_context_example = `// Set the user field on the gce context entry without touching other values
|
||||
create_context_example = `# Set the user field on the gce context entry without touching other values
|
||||
$ kubectl config set-context gce --user=cluster-admin`
|
||||
)
|
||||
|
||||
|
@@ -43,10 +43,10 @@ const (
|
||||
view_long = `displays Merged kubeconfig settings or a specified kubeconfig file.
|
||||
|
||||
You can use --output=template --template=TEMPLATE to extract specific values.`
|
||||
view_example = `// Show Merged kubeconfig settings.
|
||||
view_example = `# Show Merged kubeconfig settings.
|
||||
$ kubectl config view
|
||||
|
||||
// Get the password for the e2e user
|
||||
# Get the password for the e2e user
|
||||
$ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2e" }}{{ index .user.password }}{{end}}{{end}}'`
|
||||
)
|
||||
|
||||
|
@@ -34,10 +34,10 @@ const (
|
||||
create_long = `Create a resource by filename or stdin.
|
||||
|
||||
JSON and YAML formats are accepted.`
|
||||
create_example = `// Create a pod using the data in pod.json.
|
||||
create_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.
|
||||
# Create a pod based on the JSON passed into stdin.
|
||||
$ cat pod.json | kubectl create -f -`
|
||||
)
|
||||
|
||||
|
@@ -41,19 +41,19 @@ Only one type of the arguments may be specified: filenames, resources and names,
|
||||
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.`
|
||||
delete_example = `// Delete a pod using the type and name specified in pod.json.
|
||||
delete_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.
|
||||
# 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 label name=myLabel.
|
||||
# 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.
|
||||
# Delete a pod with UID 1234-56-7890-234234-456456.
|
||||
$ kubectl delete pod 1234-56-7890-234234-456456
|
||||
|
||||
// Delete all pods
|
||||
# Delete all pods
|
||||
$ kubectl delete pods --all`
|
||||
)
|
||||
|
||||
|
@@ -47,23 +47,23 @@ Possible resource types include (case insensitive): pods (po), services (svc),
|
||||
replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
|
||||
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota),
|
||||
namespaces (ns) or secrets.`
|
||||
describe_example = `// Describe a node
|
||||
describe_example = `# Describe a node
|
||||
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
|
||||
|
||||
// Describe a pod
|
||||
# Describe a pod
|
||||
$ kubectl describe pods/nginx
|
||||
|
||||
// Describe a pod using the data in pod.json.
|
||||
# Describe a pod using the data in pod.json.
|
||||
$ kubectl describe -f pod.json
|
||||
|
||||
// Describe all pods
|
||||
# Describe all pods
|
||||
$ kubectl describe pods
|
||||
|
||||
// Describe pods by label name=myLabel
|
||||
# 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).
|
||||
# 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`
|
||||
)
|
||||
|
||||
|
@@ -33,14 +33,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
exec_example = `// get output from running 'date' from pod 123456-7890, using the first container by default
|
||||
exec_example = `# get output from running 'date' from pod 123456-7890, using the first container by default
|
||||
$ kubectl exec 123456-7890 date
|
||||
|
||||
// get output from running 'date' in ruby-container from pod 123456-7890
|
||||
# get output from running 'date' in ruby-container from pod 123456-7890
|
||||
$ kubectl exec 123456-7890 -c ruby-container date
|
||||
|
||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
||||
// and sends stdout/stderr from 'bash' back to the client
|
||||
# switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
||||
# and sends stdout/stderr from 'bash' back to the client
|
||||
$ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il`
|
||||
)
|
||||
|
||||
|
@@ -34,16 +34,16 @@ Looks up a replication controller or service by name and uses the selector for t
|
||||
selector for a new Service on the specified port. If no labels are specified, the new service will
|
||||
re-use the labels from the resource it exposes.`
|
||||
|
||||
expose_example = `// Creates a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
||||
expose_example = `# Creates 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
|
||||
|
||||
# Creates 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
|
||||
|
||||
// Creates a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
|
||||
# Creates 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'.
|
||||
# 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`
|
||||
)
|
||||
|
||||
|
@@ -38,25 +38,25 @@ resourcequotas (quota), namespaces (ns), endpoints (ep) or 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).`
|
||||
get_example = `// List all pods in ps output format.
|
||||
get_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).
|
||||
# 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.
|
||||
# List a single replication controller with specified NAME in ps output format.
|
||||
$ kubectl get replicationcontroller web
|
||||
|
||||
// List a single pod in JSON output format.
|
||||
# List a single pod in JSON output format.
|
||||
$ kubectl get -o json pod web-pod-13je7
|
||||
|
||||
// Return only the phase value of the specified pod.
|
||||
# Return only the phase value of the specified pod.
|
||||
$ kubectl get -o template web-pod-13je7 --template={{.status.phase}} --api-version=v1
|
||||
|
||||
// List all replication controllers and services together in ps output format.
|
||||
# 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.
|
||||
# List one or more resources by their type and names.
|
||||
$ kubectl get rc/web service/frontend pods/web-pod-13je7`
|
||||
)
|
||||
|
||||
|
@@ -35,20 +35,20 @@ const (
|
||||
A label must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to %[1]d 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.`
|
||||
label_example = `// Update pod 'foo' with the label 'unhealthy' and the value 'true'.
|
||||
label_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.
|
||||
# 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
|
||||
# Update all pods in the namespace
|
||||
$ kubectl label pods --all status=unhealthy
|
||||
|
||||
// Update pod 'foo' only if the resource is unchanged from version 1.
|
||||
# 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.
|
||||
# Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||
# Does not require the --overwrite flag.
|
||||
$ kubectl label pods foo bar-`
|
||||
)
|
||||
|
||||
|
@@ -29,13 +29,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
log_example = `// Returns snapshot of ruby-container logs from pod 123456-7890.
|
||||
log_example = `# Returns snapshot of ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs 123456-7890 ruby-container
|
||||
|
||||
// Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
|
||||
# Returns snapshot of previous terminated ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs -p 123456-7890 ruby-container
|
||||
|
||||
// Starts streaming of ruby-container logs from pod 123456-7890.
|
||||
# Starts streaming of ruby-container logs from pod 123456-7890.
|
||||
$ kubectl logs -f 123456-7890 ruby-container`
|
||||
)
|
||||
|
||||
|
@@ -33,10 +33,10 @@ JSON and YAML formats are accepted.
|
||||
|
||||
Please refer to the models in https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.`
|
||||
patch_example = `
|
||||
// Partially update a node using strategic merge patch
|
||||
# Partially update a node using strategic merge patch
|
||||
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
|
||||
|
||||
// Update a container's image; spec.containers[*].name is required because it's a merge key
|
||||
# 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"}]}}'`
|
||||
)
|
||||
|
||||
|
@@ -30,16 +30,16 @@ import (
|
||||
|
||||
const (
|
||||
portforward_example = `
|
||||
// listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
|
||||
# listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
|
||||
$ kubectl port-forward mypod 5000 6000
|
||||
|
||||
// listens on port 8888 locally, forwarding to 5000 in the pod
|
||||
# listens on port 8888 locally, forwarding to 5000 in the pod
|
||||
$ kubectl port-forward mypod 8888:5000
|
||||
|
||||
// listens on a random port locally, forwarding to 5000 in the pod
|
||||
# listens on a random port locally, forwarding to 5000 in the pod
|
||||
$ kubectl port-forward mypod :5000
|
||||
|
||||
// listens on a random port locally, forwarding to 5000 in the pod
|
||||
# listens on a random port locally, forwarding to 5000 in the pod
|
||||
$ kubectl port-forward mypod 0:5000`
|
||||
)
|
||||
|
||||
|
@@ -31,15 +31,15 @@ import (
|
||||
|
||||
const (
|
||||
default_port = 8001
|
||||
proxy_example = `// Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
|
||||
proxy_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.
|
||||
# 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/
|
||||
# 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`
|
||||
)
|
||||
|
||||
|
@@ -39,16 +39,16 @@ 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/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.`
|
||||
replace_example = `// Replace a pod using the data in pod.json.
|
||||
replace_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.
|
||||
# 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
|
||||
# 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
|
||||
# Force replace, delete and then re-create the resource
|
||||
kubectl replace --force -f ./pod.json`
|
||||
)
|
||||
|
||||
|
@@ -40,17 +40,17 @@ const (
|
||||
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.`
|
||||
rollingUpdate_example = `// Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
|
||||
rollingUpdate_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.
|
||||
# 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.
|
||||
# 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
|
||||
# Update the pods of frontend by just changing the image, and keeping the old name
|
||||
$ kubectl rolling-update frontend --image=image:v2
|
||||
`
|
||||
)
|
||||
|
@@ -34,16 +34,16 @@ import (
|
||||
const (
|
||||
run_long = `Create and run a particular image, possibly replicated.
|
||||
Creates a replication controller to manage the created container(s).`
|
||||
run_example = `// Starts a single instance of nginx.
|
||||
run_example = `# Starts a single instance of nginx.
|
||||
$ kubectl run nginx --image=nginx
|
||||
|
||||
// Starts a replicated instance of nginx.
|
||||
# Starts a replicated instance of nginx.
|
||||
$ kubectl run nginx --image=nginx --replicas=5
|
||||
|
||||
// Dry run. Print the corresponding API objects without creating them.
|
||||
# Dry run. Print the corresponding API objects without creating them.
|
||||
$ kubectl run nginx --image=nginx --dry-run
|
||||
|
||||
// Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
|
||||
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
|
||||
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'`
|
||||
)
|
||||
|
||||
|
@@ -36,13 +36,13 @@ Scale also allows users to specify one or more preconditions for the scale actio
|
||||
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.`
|
||||
scale_example = `// Scale replication controller named 'foo' to 3.
|
||||
scale_example = `# Scale replication controller named 'foo' to 3.
|
||||
$ kubectl scale --replicas=3 replicationcontrollers foo
|
||||
|
||||
// If the replication controller named foo's current size is 2, scale foo to 3.
|
||||
# If the replication controller named foo's current size is 2, scale foo to 3.
|
||||
$ kubectl scale --current-replicas=2 --replicas=3 replicationcontrollers foo
|
||||
|
||||
// Scale multiple replication controllers.
|
||||
# Scale multiple replication controllers.
|
||||
$ kubectl scale --replicas=5 rc/foo rc/bar`
|
||||
)
|
||||
|
||||
|
@@ -33,16 +33,16 @@ 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.`
|
||||
stop_example = `// Shut down foo.
|
||||
stop_example = `# Shut down foo.
|
||||
$ kubectl stop replicationcontroller foo
|
||||
|
||||
// Stop pods and services with label name=myLabel.
|
||||
# Stop pods and services with label name=myLabel.
|
||||
$ kubectl stop pods,services -l name=myLabel
|
||||
|
||||
// Shut down the service defined in service.json
|
||||
# Shut down the service defined in service.json
|
||||
$ kubectl stop -f service.json
|
||||
|
||||
// Shut down all resources in the path/to/resources directory
|
||||
# Shut down all resources in the path/to/resources directory
|
||||
$ kubectl stop -f path/to/resources`
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user