update commented examples just remove $

pull/6/head
AdoHe 2016-02-29 09:41:09 -05:00
parent 1d4a9e88e0
commit 9cc668f7c6
107 changed files with 388 additions and 388 deletions

View File

@ -186,23 +186,23 @@ horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.
.nf
# 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'
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'
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'
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'
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
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\-
kubectl annotate pods foo description\-
.fi
.RE

View File

@ -142,10 +142,10 @@ JSON and YAML formats are accepted.
.nf
# Apply the configuration in pod.json to a pod.
$ kubectl apply \-f ./pod.json
kubectl apply \-f ./pod.json
# Apply the JSON passed into stdin to a pod.
$ cat pod.json | kubectl apply \-f \-
cat pod.json | kubectl apply \-f \-
.fi
.RE

View File

@ -130,14 +130,14 @@ Attach to a process that is already running inside an existing container.
.nf
# Get output from running pod 123456\-7890, using the first container by default
$ kubectl attach 123456\-7890
kubectl attach 123456\-7890
# Get output from ruby\-container from pod 123456\-7890
$ kubectl attach 123456\-7890 \-c ruby\-container
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
kubectl attach 123456\-7890 \-c ruby\-container \-i \-t
.fi
.RE

View File

@ -189,10 +189,10 @@ An autoscaler can automatically increase or decrease number of pods deployed wit
.nf
# 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
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
kubectl autoscale rc foo \-\-max=5 \-\-cpu\-percent=80
.fi
.RE

View File

@ -116,7 +116,7 @@ Displays the current\-context
.nf
# Display the current\-context
$ kubectl config current\-context
kubectl config current\-context
.fi
.RE

View File

@ -123,13 +123,13 @@ Specifying a name that already exists will merge new fields on top of existing v
.nf
# 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 e2e \-\-server=https://1.2.3.4
# Embed certificate authority data for the e2e cluster entry
$ kubectl config set\-cluster e2e \-\-certificate\-authority=\~/.kube/e2e/kubernetes.ca.crt
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
kubectl config set\-cluster e2e \-\-insecure\-skip\-tls\-verify=true
.fi
.RE

View File

@ -119,7 +119,7 @@ Specifying a name that already exists will merge new fields on top of existing v
.nf
# Set the user field on the gce context entry without touching other values
$ kubectl config set\-context gce \-\-user=cluster\-admin
kubectl config set\-context gce \-\-user=cluster\-admin
.fi
.RE

View File

@ -139,13 +139,13 @@ Bearer token and basic auth are mutually exclusive.
.nf
# 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
kubectl config set\-credentials cluster\-admin \-\-client\-key=\~/.kube/admin.key
# Set basic auth for the "cluster\-admin" entry
$ kubectl config set\-credentials cluster\-admin \-\-username=admin \-\-password=uXFGweU9l35qcif
kubectl config set\-credentials cluster\-admin \-\-username=admin \-\-password=uXFGweU9l35qcif
# Embed client certificate data in the "cluster\-admin" entry
$ kubectl config set\-credentials cluster\-admin \-\-client\-certificate=\~/.kube/admin.crt \-\-embed\-certs=true
kubectl config set\-credentials cluster\-admin \-\-client\-certificate=\~/.kube/admin.crt \-\-embed\-certs=true
.fi
.RE

View File

@ -168,10 +168,10 @@ You can use \-\-output jsonpath={...} to extract specific values using a jsonpat
.nf
# Show Merged kubeconfig settings.
$ kubectl config view
kubectl config view
# Get the password for the e2e user
$ kubectl config view \-o jsonpath='{.users[?(@.name == "e2e")].user.password}'
kubectl config view \-o jsonpath='{.users[?(@.name == "e2e")].user.password}'
.fi
.RE

View File

@ -175,14 +175,14 @@ to change to output destination.
.nf
# Convert 'pod.yaml' to latest version and print to stdout.
$ kubectl convert \-f pod.yaml
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
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 \-
kubectl convert \-f . | kubectl create \-f \-
.fi

View File

@ -116,7 +116,7 @@ Mark node as unschedulable.
.nf
# Mark node "foo" as unschedulable.
$ kubectl cordon foo
kubectl cordon foo
.fi

View File

@ -189,13 +189,13 @@ symlinks, devices, pipes, etc).
.nf
# Create a new configmap named my\-config with keys for each file in folder bar
$ kubectl create configmap generic my\-config \-\-from\-file=path/to/bar
kubectl create configmap generic my\-config \-\-from\-file=path/to/bar
# Create a new configmap named my\-config with specified keys instead of names on disk
$ kubectl create configmap generic my\-config \-\-from\-file=ssh\-privatekey=\~/.ssh/id\_rsa \-\-from\-file=ssh\-publickey=\~/.ssh/id\_rsa.pub
kubectl create configmap generic my\-config \-\-from\-file=ssh\-privatekey=\~/.ssh/id\_rsa \-\-from\-file=ssh\-publickey=\~/.ssh/id\_rsa.pub
# Create a new configMap named my\-config with key1=config1 and key2=config2
$ kubectl create configmap generic my\-config \-\-from\-literal=key1=config1 \-\-from\-literal=key2=config2
kubectl create configmap generic my\-config \-\-from\-literal=key1=config1 \-\-from\-literal=key2=config2
.fi
.RE

View File

@ -169,7 +169,7 @@ Create a namespace with the specified name.
.nf
# Create a new namespace named my\-namespace
$ kubectl create namespace my\-namespace
kubectl create namespace my\-namespace
.fi
.RE

View File

@ -193,13 +193,13 @@ symlinks, devices, pipes, etc).
.nf
# Create a new secret named my\-secret with keys for each file in folder bar
$ kubectl create secret generic my\-secret \-\-from\-file=path/to/bar
kubectl create secret generic my\-secret \-\-from\-file=path/to/bar
# Create a new secret named my\-secret with specified keys instead of names on disk
$ kubectl create secret generic my\-secret \-\-from\-file=ssh\-privatekey=\~/.ssh/id\_rsa \-\-from\-file=ssh\-publickey=\~/.ssh/id\_rsa.pub
kubectl create secret generic my\-secret \-\-from\-file=ssh\-privatekey=\~/.ssh/id\_rsa \-\-from\-file=ssh\-publickey=\~/.ssh/id\_rsa.pub
# Create a new secret named my\-secret with key1=supersecret and key2=topsecret
$ kubectl create secret generic my\-secret \-\-from\-literal=key1=supersecret \-\-from\-literal=key2=topsecret
kubectl create secret generic my\-secret \-\-from\-literal=key1=supersecret \-\-from\-literal=key2=topsecret
.fi
.RE

View File

@ -145,10 +145,10 @@ JSON and YAML formats are accepted.
.nf
# Create a pod using the data in pod.json.
$ kubectl create \-f ./pod.json
kubectl create \-f ./pod.json
# Create a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl create \-f \-
cat pod.json | kubectl create \-f \-
.fi
.RE

View File

@ -161,22 +161,22 @@ will be lost along with the rest of the resource.
.nf
# Delete a pod using the type and name specified in pod.json.
$ kubectl delete \-f ./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 \-
cat pod.json | kubectl delete \-f \-
# Delete pods and services with same names "baz" and "foo"
$ kubectl delete pod,service baz foo
kubectl delete pod,service baz foo
# Delete pods and services with label name=myLabel.
$ kubectl delete pods,services \-l 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
kubectl delete pod 1234\-56\-7890\-234234\-456456
# Delete all pods
$ kubectl delete pods \-\-all
kubectl delete pods \-\-all
.fi
.RE

View File

@ -144,23 +144,23 @@ endpoints (ep) or secrets.
.nf
# Describe a node
$ kubectl describe nodes kubernetes\-minion\-emt8.c.myproject.internal
kubectl describe nodes kubernetes\-minion\-emt8.c.myproject.internal
# Describe a pod
$ kubectl describe pods/nginx
kubectl describe pods/nginx
# Describe a pod identified by type and name in "pod.json"
$ kubectl describe \-f pod.json
kubectl describe \-f pod.json
# Describe all pods
$ kubectl describe pods
kubectl describe pods
# Describe pods by label name=myLabel
$ kubectl describe po \-l 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
kubectl describe pods frontend
.fi
.RE

View File

@ -163,13 +163,13 @@ saved copy to include the latest resource version.
.nf
# Edit the service named 'docker\-registry':
$ kubectl edit svc/docker\-registry
kubectl edit svc/docker\-registry
# Use an alternative editor
$ KUBE\_EDITOR="nano" kubectl edit svc/docker\-registry
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
kubectl edit svc/docker\-registry \-\-output\-version=v1 \-o json
.fi
.RE

View File

@ -134,14 +134,14 @@ Execute a command in a container.
.nf
# Get output from running 'date' from pod 123456\-7890, using the first container by default
$ kubectl exec 123456\-7890 date
kubectl exec 123456\-7890 date
# Get output from running 'date' in ruby\-container from pod 123456\-7890
$ kubectl exec 123456\-7890 \-c ruby\-container date
kubectl exec 123456\-7890 \-c ruby\-container date
# 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 exec 123456\-7890 \-c ruby\-container \-i \-t \-\- bash \-il
kubectl exec 123456\-7890 \-c ruby\-container \-i \-t \-\- bash \-il
.fi
.RE

View File

@ -129,10 +129,10 @@ or endpoints (ep).
.nf
# Get the documentation of the resource and its fields
$ kubectl explain pods
kubectl explain pods
# Get the documentation of a specific field of a resource
$ kubectl explain pods.spec.containers
kubectl explain pods.spec.containers
.fi
.RE

View File

@ -229,22 +229,22 @@ if no labels are specified, the new service will re\-use the labels from the res
.nf
# 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
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
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
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
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
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
kubectl expose rs nginx \-\-port=80 \-\-target\-port=8000
.fi
.RE

View File

@ -188,28 +188,28 @@ of the \-\-template flag, you can filter the attributes of the fetched resource(
.nf
# List all pods in ps output format.
$ kubectl get pods
kubectl get pods
# List all pods in ps output format with more information (such as node name).
$ kubectl get pods \-o wide
kubectl get pods \-o wide
# List a single replication controller with specified NAME in ps output format.
$ kubectl get replicationcontroller web
kubectl get replicationcontroller web
# List a single pod in JSON output format.
$ kubectl get \-o json pod web\-pod\-13je7
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
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}} \-\-api\-version=v1
kubectl get \-o template pod/web\-pod\-13je7 \-\-template={{.status.phase}} \-\-api\-version=v1
# List all replication controllers and services together in ps output format.
$ kubectl get rc,services
kubectl get rc,services
# List one or more resources by their type and names.
$ kubectl get rc/web service/frontend pods/web\-pod\-13je7
kubectl get rc/web service/frontend pods/web\-pod\-13je7
.fi
.RE

View File

@ -182,23 +182,23 @@ If \-\-resource\-version is specified, then updates will use this resource versi
.nf
# Update pod 'foo' with the label 'unhealthy' and the value 'true'.
$ kubectl label pods foo unhealthy=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
kubectl label \-\-overwrite pods foo status=unhealthy
# Update all pods in the namespace
$ kubectl label pods \-\-all status=unhealthy
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
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
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\-
kubectl label pods foo bar\-
.fi
.RE

View File

@ -154,19 +154,19 @@ Print the logs for a container in a pod. If the pod has only one container, the
.nf
# Return snapshot logs from pod nginx with only one container
$ kubectl logs nginx
kubectl logs nginx
# Return snapshot of previous terminated ruby container logs from pod web\-1
$ kubectl logs \-p \-c ruby 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
kubectl logs \-f \-c ruby web\-1
# Display only the most recent 20 lines of output in pod nginx
$ kubectl logs \-\-tail=20 nginx
kubectl logs \-\-tail=20 nginx
# Show all logs from pod nginx written in the last hour
$ kubectl logs \-\-since=1h nginx
kubectl logs \-\-since=1h nginx
.fi
.RE

View File

@ -123,16 +123,16 @@ Forward one or more local ports to a pod.
.nf
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
$ kubectl port\-forward mypod 5000 6000
kubectl port\-forward mypod 5000 6000
# Listen on port 8888 locally, forwarding to 5000 in the pod
$ kubectl port\-forward mypod 8888:5000
kubectl port\-forward mypod 8888:5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port\-forward mypod :5000
kubectl port\-forward mypod :5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port\-forward mypod 0:5000
kubectl port\-forward mypod 0:5000
.fi
.RE

View File

@ -183,15 +183,15 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
.nf
# Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
$ kubectl proxy \-\-port=8011 \-\-www=./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
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
kubectl proxy \-\-api\-prefix=/k8s\-api
.fi
.RE

View File

@ -167,10 +167,10 @@ Please refer to the models in
.nf
# Replace a pod using the data in pod.json.
$ kubectl replace \-f ./pod.json
kubectl replace \-f ./pod.json
# Replace a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl replace \-f \-
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 \-

View File

@ -198,20 +198,20 @@ existing replication controller and overwrite at least one (common) label in its
.nf
# Update pods of frontend\-v1 using new replication controller data in frontend\-v2.json.
$ kubectl rolling\-update frontend\-v1 \-f 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 \-
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
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
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
kubectl rolling\-update frontend\-v1 frontend\-v2 \-\-rollback
.fi

View File

@ -126,7 +126,7 @@ view previous rollout revisions and configurations.
.nf
# View the rollout history of a deployment
$ kubectl rollout history deployment/abc
kubectl rollout history deployment/abc
.fi
.RE

View File

@ -129,7 +129,7 @@ Currently only deployments support being paused.
# Mark the nginx deployment as paused. Any current state of
# the deployment will continue its function, new updates to the deployment will not
# have an effect as long as the deployment is paused.
$ kubectl rollout pause deployment/nginx
kubectl rollout pause deployment/nginx
.fi
.RE

View File

@ -127,7 +127,7 @@ Currently only deployments support being resumed.
.nf
# Resume an already paused deployment
$ kubectl rollout resume deployment/nginx
kubectl rollout resume deployment/nginx
.fi
.RE

View File

@ -126,7 +126,7 @@ undo rolls back to a previous rollout.
.nf
# Rollback to the previous deployment
$ kubectl rollout undo deployment/abc
kubectl rollout undo deployment/abc
.fi
.RE

View File

@ -116,7 +116,7 @@ rollout manages a deployment using subcommands like "kubectl rollout undo deploy
.nf
# Rollback to the previous deployment
$ kubectl rollout undo deployment/abc
kubectl rollout undo deployment/abc
.fi
.RE

View File

@ -242,34 +242,34 @@ Creates a deployment or job to manage the created container(s).
.nf
# Start a single instance of nginx.
$ kubectl run nginx \-\-image=nginx
kubectl run nginx \-\-image=nginx
# Start a single instance of hazelcast and let the container expose port 5701 .
$ kubectl run hazelcast \-\-image=hazelcast \-\-port=5701
kubectl run hazelcast \-\-image=hazelcast \-\-port=5701
# Start a single instance of hazelcast and set environment variables "DNS\_DOMAIN=cluster" and "POD\_NAMESPACE=default" in the container.
$ kubectl run hazelcast \-\-image=hazelcast \-\-env="DNS\_DOMAIN=cluster" \-\-env="POD\_NAMESPACE=default"
kubectl run hazelcast \-\-image=hazelcast \-\-env="DNS\_DOMAIN=cluster" \-\-env="POD\_NAMESPACE=default"
# Start a replicated instance of nginx.
$ kubectl run nginx \-\-image=nginx \-\-replicas=5
kubectl run nginx \-\-image=nginx \-\-replicas=5
# Dry run. Print the corresponding API objects without creating them.
$ kubectl run nginx \-\-image=nginx \-\-dry\-run
kubectl run nginx \-\-image=nginx \-\-dry\-run
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
$ kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
$ kubectl run \-i \-\-tty busybox \-\-image=busybox \-\-restart=Never
kubectl run \-i \-\-tty busybox \-\-image=busybox \-\-restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
$ kubectl run nginx \-\-image=nginx \-\- <arg1> <arg2> ... <argN>
kubectl run nginx \-\-image=nginx \-\- <arg1> <arg2> ... <argN>
# Start the nginx container using a different command and custom arguments.
$ kubectl run nginx \-\-image=nginx \-\-command \-\- <cmd> <arg1> ... <argN>
kubectl run nginx \-\-image=nginx \-\-command \-\- <cmd> <arg1> ... <argN>
# Start the perl container to compute π to 2000 places and print it out.
$ kubectl run pi \-\-image=perl \-\-restart=OnFailure \-\- perl \-Mbignum=bpi \-wle 'print bpi(2000)'
kubectl run pi \-\-image=perl \-\-restart=OnFailure \-\- perl \-Mbignum=bpi \-wle 'print bpi(2000)'
.fi
.RE

View File

@ -152,19 +152,19 @@ scale is sent to the server.
.nf
# Scale replication controller named 'foo' to 3.
$ kubectl scale \-\-replicas=3 rc/foo
kubectl scale \-\-replicas=3 rc/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3.
$ kubectl scale \-\-replicas=3 \-f foo.yaml
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
kubectl scale \-\-current\-replicas=2 \-\-replicas=3 deployment/mysql
# Scale multiple replication controllers.
$ kubectl scale \-\-replicas=5 rc/foo rc/bar rc/baz
kubectl scale \-\-replicas=5 rc/foo rc/bar rc/baz
# Scale job named 'cron' to 3.
$ kubectl scale \-\-replicas=3 job/cron
kubectl scale \-\-replicas=3 job/cron
.fi
.RE

View File

@ -154,16 +154,16 @@ If the resource is scalable it will be scaled to 0 before deletion.
.nf
# Shut down foo.
$ kubectl stop replicationcontroller foo
kubectl stop replicationcontroller foo
# Stop pods and services with label name=myLabel.
$ kubectl stop pods,services \-l name=myLabel
kubectl stop pods,services \-l name=myLabel
# Shut down the service defined in service.json
$ kubectl stop \-f service.json
kubectl stop \-f service.json
# Shut down all resources in the path/to/resources directory
$ kubectl stop \-f path/to/resources
kubectl stop \-f path/to/resources
.fi
.RE

View File

@ -60,23 +60,23 @@ kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=V
```
# 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'
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'
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'
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'
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
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-
kubectl annotate pods foo description-
```
### Options
@ -129,7 +129,7 @@ $ kubectl annotate pods foo description-
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_annotate.md?pixel)]()

View File

@ -52,10 +52,10 @@ kubectl apply -f FILENAME
```
# Apply the configuration in pod.json to a pod.
$ kubectl apply -f ./pod.json
kubectl apply -f ./pod.json
# Apply the JSON passed into stdin to a pod.
$ cat pod.json | kubectl apply -f -
cat pod.json | kubectl apply -f -
```
### Options
@ -100,7 +100,7 @@ $ cat pod.json | kubectl apply -f -
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 22-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_apply.md?pixel)]()

View File

@ -49,14 +49,14 @@ kubectl attach POD -c CONTAINER
```
# Get output from running pod 123456-7890, using the first container by default
$ kubectl attach 123456-7890
kubectl attach 123456-7890
# Get output from ruby-container from pod 123456-7890
$ kubectl attach 123456-7890 -c ruby-container
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
kubectl attach 123456-7890 -c ruby-container -i -t
```
### Options
@ -99,7 +99,7 @@ $ kubectl attach 123456-7890 -c ruby-container -i -t
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_attach.md?pixel)]()

View File

@ -52,10 +52,10 @@ kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MA
```
# 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
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
kubectl autoscale rc foo --max=5 --cpu-percent=80
```
### Options
@ -111,7 +111,7 @@ $ kubectl autoscale rc foo --max=5 --cpu-percent=80
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_autoscale.md?pixel)]()

View File

@ -44,7 +44,7 @@ kubectl config current-context
```
# Display the current-context
$ kubectl config current-context
kubectl config current-context
```
### Options inherited from parent commands
@ -79,7 +79,7 @@ $ kubectl config current-context
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
###### Auto generated by spf13/cobra on 9-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_current-context.md?pixel)]()

View File

@ -50,13 +50,13 @@ kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/
```
# 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 e2e --server=https://1.2.3.4
# Embed certificate authority data for the e2e cluster entry
$ kubectl config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
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
kubectl config set-cluster e2e --insecure-skip-tls-verify=true
```
### Options
@ -97,7 +97,7 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
###### Auto generated by spf13/cobra on 8-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-cluster.md?pixel)]()

View File

@ -50,7 +50,7 @@ kubectl config set-context NAME [--cluster=cluster_nickname] [--user=user_nickna
```
# Set the user field on the gce context entry without touching other values
$ kubectl config set-context gce --user=cluster-admin
kubectl config set-context gce --user=cluster-admin
```
### Options
@ -90,7 +90,7 @@ $ kubectl config set-context gce --user=cluster-admin
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-context.md?pixel)]()

View File

@ -63,13 +63,13 @@ kubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--c
```
# 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
kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key
# Set basic auth for the "cluster-admin" entry
$ kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
# Embed client certificate data in the "cluster-admin" entry
$ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
```
### Options
@ -110,7 +110,7 @@ $ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admi
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
###### Auto generated by spf13/cobra on 8-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-credentials.md?pixel)]()

View File

@ -51,10 +51,10 @@ kubectl config view
```
# Show Merged kubeconfig settings.
$ kubectl config view
kubectl config view
# Get the password for the e2e user
$ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
```
### Options
@ -105,7 +105,7 @@ $ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_view.md?pixel)]()

View File

@ -53,14 +53,14 @@ kubectl convert -f FILENAME
```
# Convert 'pod.yaml' to latest version and print to stdout.
$ kubectl convert -f pod.yaml
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
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 -
kubectl convert -f . | kubectl create -f -
```
@ -112,7 +112,7 @@ $ kubectl convert -f . | kubectl create -f -
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_convert.md?pixel)]()

View File

@ -45,7 +45,7 @@ kubectl cordon NODE
```
# Mark node "foo" as unschedulable.
$ kubectl cordon foo
kubectl cordon foo
```
@ -81,7 +81,7 @@ $ kubectl cordon foo
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 4-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_cordon.md?pixel)]()

View File

@ -51,10 +51,10 @@ kubectl create -f FILENAME
```
# Create a pod using the data in pod.json.
$ kubectl create -f ./pod.json
kubectl create -f ./pod.json
# Create a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl create -f -
cat pod.json | kubectl create -f -
```
### Options
@ -103,7 +103,7 @@ $ cat pod.json | kubectl create -f -
* [kubectl create namespace](kubectl_create_namespace.md) - Create a namespace with the specified name.
* [kubectl create secret](kubectl_create_secret.md) - Create a secret using specified subcommand.
###### Auto generated by spf13/cobra on 17-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_create.md?pixel)]()

View File

@ -54,13 +54,13 @@ kubectl create configmap NAME [--type=string] [--from-file=[key=]source] [--from
```
# Create a new configmap named my-config with keys for each file in folder bar
$ kubectl create configmap generic my-config --from-file=path/to/bar
kubectl create configmap generic my-config --from-file=path/to/bar
# Create a new configmap named my-config with specified keys instead of names on disk
$ kubectl create configmap generic my-config --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
kubectl create configmap generic my-config --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
# Create a new configMap named my-config with key1=config1 and key2=config2
$ kubectl create configmap generic my-config --from-literal=key1=config1 --from-literal=key2=config2
kubectl create configmap generic my-config --from-literal=key1=config1 --from-literal=key2=config2
```
### Options
@ -114,7 +114,7 @@ kubectl create configmap NAME [--type=string] [--from-file=[key=]source] [--from
* [kubectl create](kubectl_create.md) - Create a resource by filename or stdin
###### Auto generated by spf13/cobra on 18-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_create_configmap.md?pixel)]()

View File

@ -45,7 +45,7 @@ kubectl create namespace NAME [--dry-run]
```
# Create a new namespace named my-namespace
$ kubectl create namespace my-namespace
kubectl create namespace my-namespace
```
### Options
@ -97,7 +97,7 @@ kubectl create namespace NAME [--dry-run]
* [kubectl create](kubectl_create.md) - Create a resource by filename or stdin
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_create_namespace.md?pixel)]()

View File

@ -55,13 +55,13 @@ kubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [-
```
# Create a new secret named my-secret with keys for each file in folder bar
$ kubectl create secret generic my-secret --from-file=path/to/bar
kubectl create secret generic my-secret --from-file=path/to/bar
# Create a new secret named my-secret with specified keys instead of names on disk
$ kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
# Create a new secret named my-secret with key1=supersecret and key2=topsecret
$ kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
### Options
@ -116,7 +116,7 @@ kubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [-
* [kubectl create secret](kubectl_create_secret.md) - Create a secret using specified subcommand.
###### Auto generated by spf13/cobra on 18-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_create_secret_generic.md?pixel)]()

View File

@ -57,22 +57,22 @@ kubectl delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])
```
# Delete a pod using the type and name specified in pod.json.
$ kubectl delete -f ./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 -
cat pod.json | kubectl delete -f -
# Delete pods and services with same names "baz" and "foo"
$ kubectl delete pod,service baz foo
kubectl delete pod,service baz foo
# Delete pods and services with label name=myLabel.
$ kubectl delete pods,services -l 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
kubectl delete pod 1234-56-7890-234234-456456
# Delete all pods
$ kubectl delete pods --all
kubectl delete pods --all
```
### Options
@ -120,7 +120,7 @@ $ kubectl delete pods --all
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_delete.md?pixel)]()

View File

@ -63,23 +63,23 @@ kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)
```
# Describe a node
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
# Describe a pod
$ kubectl describe pods/nginx
kubectl describe pods/nginx
# Describe a pod identified by type and name in "pod.json"
$ kubectl describe -f pod.json
kubectl describe -f pod.json
# Describe all pods
$ kubectl describe pods
kubectl describe pods
# Describe pods by label name=myLabel
$ kubectl describe po -l 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
kubectl describe pods frontend
```
### Options
@ -121,7 +121,7 @@ $ kubectl describe pods frontend
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_describe.md?pixel)]()

View File

@ -67,13 +67,13 @@ kubectl edit (RESOURCE/NAME | -f FILENAME)
```
# Edit the service named 'docker-registry':
$ kubectl edit svc/docker-registry
kubectl edit svc/docker-registry
# Use an alternative editor
$ KUBE_EDITOR="nano" kubectl edit svc/docker-registry
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
kubectl edit svc/docker-registry --output-version=v1 -o json
```
### Options
@ -119,7 +119,7 @@ kubectl edit (RESOURCE/NAME | -f FILENAME)
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 22-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_edit.md?pixel)]()

View File

@ -49,14 +49,14 @@ kubectl exec POD [-c CONTAINER] -- COMMAND [args...]
```
# Get output from running 'date' from pod 123456-7890, using the first container by default
$ kubectl exec 123456-7890 date
kubectl exec 123456-7890 date
# Get output from running 'date' in ruby-container from pod 123456-7890
$ kubectl exec 123456-7890 -c ruby-container date
kubectl exec 123456-7890 -c ruby-container date
# 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 exec 123456-7890 -c ruby-container -i -t -- bash -il
kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
```
### Options
@ -100,7 +100,7 @@ $ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_exec.md?pixel)]()

View File

@ -50,10 +50,10 @@ kubectl explain RESOURCE
```
# Get the documentation of the resource and its fields
$ kubectl explain pods
kubectl explain pods
# Get the documentation of a specific field of a resource
$ kubectl explain pods.spec.containers
kubectl explain pods.spec.containers
```
### Options
@ -94,7 +94,7 @@ $ kubectl explain pods.spec.containers
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 24-Nov-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_explain.md?pixel)]()

View File

@ -56,22 +56,22 @@ kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--t
```
# 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
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
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
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
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
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
kubectl expose rs nginx --port=80 --target-port=8000
```
### Options
@ -135,7 +135,7 @@ $ kubectl expose rs nginx --port=80 --target-port=8000
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_expose.md?pixel)]()

View File

@ -58,28 +58,28 @@ kubectl get [(-o|--output=)json|yaml|wide|go-template=...|go-template-file=...|j
```
# List all pods in ps output format.
$ kubectl get pods
kubectl get pods
# List all pods in ps output format with more information (such as node name).
$ kubectl get pods -o wide
kubectl get pods -o wide
# List a single replication controller with specified NAME in ps output format.
$ kubectl get replicationcontroller web
kubectl get replicationcontroller web
# List a single pod in JSON output format.
$ kubectl get -o json pod web-pod-13je7
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
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}} --api-version=v1
kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} --api-version=v1
# List all replication controllers and services together in ps output format.
$ kubectl get rc,services
kubectl get rc,services
# List one or more resources by their type and names.
$ kubectl get rc/web service/frontend pods/web-pod-13je7
kubectl get rc/web service/frontend pods/web-pod-13je7
```
### Options
@ -133,7 +133,7 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_get.md?pixel)]()

View File

@ -53,23 +53,23 @@ kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_
```
# Update pod 'foo' with the label 'unhealthy' and the value 'true'.
$ kubectl label pods foo unhealthy=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
kubectl label --overwrite pods foo status=unhealthy
# Update all pods in the namespace
$ kubectl label pods --all status=unhealthy
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
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
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-
kubectl label pods foo bar-
```
### Options
@ -123,7 +123,7 @@ $ kubectl label pods foo bar-
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_label.md?pixel)]()

View File

@ -49,19 +49,19 @@ kubectl logs [-f] [-p] POD [-c CONTAINER]
```
# Return snapshot logs from pod nginx with only one container
$ kubectl logs nginx
kubectl logs nginx
# Return snapshot of previous terminated ruby container logs from pod web-1
$ kubectl logs -p -c ruby 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
kubectl logs -f -c ruby web-1
# Display only the most recent 20 lines of output in pod nginx
$ kubectl logs --tail=20 nginx
kubectl logs --tail=20 nginx
# Show all logs from pod nginx written in the last hour
$ kubectl logs --since=1h nginx
kubectl logs --since=1h nginx
```
### Options
@ -109,7 +109,7 @@ $ kubectl logs --since=1h nginx
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_logs.md?pixel)]()

View File

@ -50,16 +50,16 @@ kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT
```
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
$ kubectl port-forward mypod 5000 6000
kubectl port-forward mypod 5000 6000
# Listen on port 8888 locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod 8888:5000
kubectl port-forward mypod 8888:5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod :5000
kubectl port-forward mypod :5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod 0:5000
kubectl port-forward mypod 0:5000
```
### Options
@ -100,7 +100,7 @@ $ kubectl port-forward mypod 0:5000
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_port-forward.md?pixel)]()

View File

@ -64,15 +64,15 @@ kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-pref
```
# Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
$ kubectl proxy --port=8011 --www=./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
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
kubectl proxy --api-prefix=/k8s-api
```
### Options
@ -123,7 +123,7 @@ $ kubectl proxy --api-prefix=/k8s-api
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 8-Dec-2015
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_proxy.md?pixel)]()

View File

@ -55,10 +55,10 @@ kubectl replace -f FILENAME
```
# Replace a pod using the data in pod.json.
$ kubectl replace -f ./pod.json
kubectl replace -f ./pod.json
# Replace a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl replace -f -
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 -
@ -114,7 +114,7 @@ kubectl replace --force -f ./pod.json
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 22-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_replace.md?pixel)]()

View File

@ -53,20 +53,20 @@ kubectl rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CO
```
# Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
$ kubectl rolling-update frontend-v1 -f 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 -
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
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
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
kubectl rolling-update frontend-v1 frontend-v2 --rollback
```
@ -125,7 +125,7 @@ $ kubectl rolling-update frontend-v1 frontend-v2 --rollback
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rolling-update.md?pixel)]()

View File

@ -44,7 +44,7 @@ kubectl rollout SUBCOMMAND
```
# Rollback to the previous deployment
$ kubectl rollout undo deployment/abc
kubectl rollout undo deployment/abc
```
### Options inherited from parent commands
@ -83,7 +83,7 @@ $ kubectl rollout undo deployment/abc
* [kubectl rollout resume](kubectl_rollout_resume.md) - Resume a paused resource
* [kubectl rollout undo](kubectl_rollout_undo.md) - undoes a previous rollout
###### Auto generated by spf13/cobra on 2-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rollout.md?pixel)]()

View File

@ -44,7 +44,7 @@ kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]
```
# View the rollout history of a deployment
$ kubectl rollout history deployment/abc
kubectl rollout history deployment/abc
```
### Options
@ -86,7 +86,7 @@ $ kubectl rollout history deployment/abc
* [kubectl rollout](kubectl_rollout.md) - rollout manages a deployment
###### Auto generated by spf13/cobra on 29-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rollout_history.md?pixel)]()

View File

@ -50,7 +50,7 @@ kubectl rollout pause RESOURCE
# Mark the nginx deployment as paused. Any current state of
# the deployment will continue its function, new updates to the deployment will not
# have an effect as long as the deployment is paused.
$ kubectl rollout pause deployment/nginx
kubectl rollout pause deployment/nginx
```
### Options
@ -91,7 +91,7 @@ $ kubectl rollout pause deployment/nginx
* [kubectl rollout](kubectl_rollout.md) - rollout manages a deployment
###### Auto generated by spf13/cobra on 2-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rollout_pause.md?pixel)]()

View File

@ -48,7 +48,7 @@ kubectl rollout resume RESOURCE
```
# Resume an already paused deployment
$ kubectl rollout resume deployment/nginx
kubectl rollout resume deployment/nginx
```
### Options
@ -89,7 +89,7 @@ $ kubectl rollout resume deployment/nginx
* [kubectl rollout](kubectl_rollout.md) - rollout manages a deployment
###### Auto generated by spf13/cobra on 2-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rollout_resume.md?pixel)]()

View File

@ -44,7 +44,7 @@ kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]
```
# Rollback to the previous deployment
$ kubectl rollout undo deployment/abc
kubectl rollout undo deployment/abc
```
### Options
@ -86,7 +86,7 @@ $ kubectl rollout undo deployment/abc
* [kubectl rollout](kubectl_rollout.md) - rollout manages a deployment
###### Auto generated by spf13/cobra on 29-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rollout_undo.md?pixel)]()

View File

@ -50,34 +50,34 @@ kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=rep
```
# Start a single instance of nginx.
$ kubectl run nginx --image=nginx
kubectl run nginx --image=nginx
# Start a single instance of hazelcast and let the container expose port 5701 .
$ kubectl run hazelcast --image=hazelcast --port=5701
kubectl run hazelcast --image=hazelcast --port=5701
# Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
$ kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
# Start a replicated instance of nginx.
$ kubectl run nginx --image=nginx --replicas=5
kubectl run nginx --image=nginx --replicas=5
# Dry run. Print the corresponding API objects without creating them.
$ kubectl run nginx --image=nginx --dry-run
kubectl run nginx --image=nginx --dry-run
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
$ kubectl run -i --tty busybox --image=busybox --restart=Never
kubectl run -i --tty busybox --image=busybox --restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
$ kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
# Start the nginx container using a different command and custom arguments.
$ kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
# Start the perl container to compute π to 2000 places and print it out.
$ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
```
### Options
@ -147,7 +147,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 14-Feb-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_run.md?pixel)]()

View File

@ -54,19 +54,19 @@ kubectl scale [--resource-version=version] [--current-replicas=count] --replicas
```
# Scale replication controller named 'foo' to 3.
$ kubectl scale --replicas=3 rc/foo
kubectl scale --replicas=3 rc/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3.
$ kubectl scale --replicas=3 -f foo.yaml
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
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
# Scale multiple replication controllers.
$ kubectl scale --replicas=5 rc/foo rc/bar rc/baz
kubectl scale --replicas=5 rc/foo rc/bar rc/baz
# Scale job named 'cron' to 3.
$ kubectl scale --replicas=3 job/cron
kubectl scale --replicas=3 job/cron
```
### Options
@ -113,7 +113,7 @@ $ kubectl scale --replicas=3 job/cron
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 22-Jan-2016
###### Auto generated by spf13/cobra on 29-Feb-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_scale.md?pixel)]()

View File

@ -68,23 +68,23 @@ limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc),
horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.`
annotate_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'
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'
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'
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'
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
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-`
kubectl annotate pods foo description-`
)
func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -43,10 +43,10 @@ The resource will be created if it doesn't exist yet.
JSON and YAML formats are accepted.`
apply_example = `# Apply the configuration in pod.json to a pod.
$ kubectl apply -f ./pod.json
kubectl apply -f ./pod.json
# Apply the JSON passed into stdin to a pod.
$ cat pod.json | kubectl apply -f -`
cat pod.json | kubectl apply -f -`
)
func NewCmdApply(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -36,14 +36,14 @@ import (
const (
attach_example = `# Get output from running pod 123456-7890, using the first container by default
$ kubectl attach 123456-7890
kubectl attach 123456-7890
# Get output from ruby-container from pod 123456-7890
$ kubectl attach 123456-7890 -c ruby-container
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`
kubectl attach 123456-7890 -c ruby-container -i -t`
)
func NewCmdAttach(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command {

View File

@ -35,10 +35,10 @@ Looks up a deployment or replication controller by name and creates an autoscale
An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.`
autoscaleExample = `# 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
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`
kubectl autoscale rc foo --max=5 --cpu-percent=80`
)
func NewCmdAutoscale(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -60,13 +60,13 @@ Specifying a name that already exists will merge new fields on top of existing v
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
kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key
# Set basic auth for the "cluster-admin" entry
$ kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
# Embed client certificate data in the "cluster-admin" entry
$ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true`
kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true`
func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Command {
options := &createAuthInfoOptions{configAccess: configAccess}

View File

@ -44,13 +44,13 @@ 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.
$ kubectl config set-cluster e2e --server=https://1.2.3.4
kubectl config set-cluster e2e --server=https://1.2.3.4
# Embed certificate authority data for the e2e cluster entry
$ kubectl config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
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`
kubectl config set-cluster e2e --insecure-skip-tls-verify=true`
)
func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Command {

View File

@ -40,7 +40,7 @@ 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
$ kubectl config set-context gce --user=cluster-admin`
kubectl config set-context gce --user=cluster-admin`
)
func NewCmdConfigSetContext(out io.Writer, configAccess ConfigAccess) *cobra.Command {

View File

@ -31,7 +31,7 @@ type CurrentContextOptions struct {
const (
current_context_long = `Displays the current-context`
current_context_example = `# Display the current-context
$ kubectl config current-context`
kubectl config current-context`
)
func NewCmdConfigCurrentContext(out io.Writer, configAccess ConfigAccess) *cobra.Command {

View File

@ -44,10 +44,10 @@ const (
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.`
view_example = `# Show Merged kubeconfig settings.
$ kubectl config view
kubectl config view
# Get the password for the e2e user
$ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'`
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'`
)
func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command {

View File

@ -43,14 +43,14 @@ The default output will be printed to stdout in YAML format. One can use -o opti
to change to output destination.
`
convert_example = `# Convert 'pod.yaml' to latest version and print to stdout.
$ kubectl convert -f pod.yaml
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
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 -
kubectl convert -f . | kubectl create -f -
`
)

View File

@ -42,10 +42,10 @@ const (
JSON and YAML formats are accepted.`
create_example = `# Create a pod using the data in pod.json.
$ kubectl create -f ./pod.json
kubectl create -f ./pod.json
# Create a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl create -f -`
cat pod.json | kubectl create -f -`
)
func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -40,13 +40,13 @@ symlinks, devices, pipes, etc).
`
configMapExample = ` # Create a new configmap named my-config with keys for each file in folder bar
$ kubectl create configmap generic my-config --from-file=path/to/bar
kubectl create configmap generic my-config --from-file=path/to/bar
# Create a new configmap named my-config with specified keys instead of names on disk
$ kubectl create configmap generic my-config --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
kubectl create configmap generic my-config --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
# Create a new configMap named my-config with key1=config1 and key2=config2
$ kubectl create configmap generic my-config --from-literal=key1=config1 --from-literal=key2=config2`
kubectl create configmap generic my-config --from-literal=key1=config1 --from-literal=key2=config2`
)
// ConfigMap is a command to ease creating ConfigMaps.

View File

@ -31,7 +31,7 @@ const (
Create a namespace with the specified name.`
namespaceExample = ` # Create a new namespace named my-namespace
$ kubectl create namespace my-namespace`
kubectl create namespace my-namespace`
)
// NewCmdCreateNamespace is a macro command to create a new namespace

View File

@ -56,13 +56,13 @@ symlinks, devices, pipes, etc).
`
secretExample = ` # Create a new secret named my-secret with keys for each file in folder bar
$ kubectl create secret generic my-secret --from-file=path/to/bar
kubectl create secret generic my-secret --from-file=path/to/bar
# Create a new secret named my-secret with specified keys instead of names on disk
$ kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
# Create a new secret named my-secret with key1=supersecret and key2=topsecret
$ kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret`
kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret`
)
// NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values

View File

@ -48,22 +48,22 @@ 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.
$ kubectl delete -f ./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 -
cat pod.json | kubectl delete -f -
# Delete pods and services with same names "baz" and "foo"
$ kubectl delete pod,service baz foo
kubectl delete pod,service baz foo
# Delete pods and services with label name=myLabel.
$ kubectl delete pods,services -l 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
kubectl delete pod 1234-56-7890-234234-456456
# Delete all pods
$ kubectl delete pods --all`
kubectl delete pods --all`
)
func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -55,23 +55,23 @@ persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota),
namespaces (ns), serviceaccounts, horizontalpodautoscalers (hpa),
endpoints (ep) or secrets.`
describe_example = `# Describe a node
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
# Describe a pod
$ kubectl describe pods/nginx
kubectl describe pods/nginx
# Describe a pod identified by type and name in "pod.json"
$ kubectl describe -f pod.json
kubectl describe -f pod.json
# Describe all pods
$ kubectl describe pods
kubectl describe pods
# Describe pods by label name=myLabel
$ kubectl describe po -l 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`
kubectl describe pods frontend`
)
func NewCmdDescribe(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -53,7 +53,7 @@ const (
cordon_long = `Mark node as unschedulable.
`
cordon_example = `# Mark node "foo" as unschedulable.
$ kubectl cordon foo
kubectl cordon foo
`
)

View File

@ -64,13 +64,13 @@ to apply your changes to the newer version of the resource, or update your tempo
saved copy to include the latest resource version.`
editExample = ` # Edit the service named 'docker-registry':
$ kubectl edit svc/docker-registry
kubectl edit svc/docker-registry
# Use an alternative editor
$ KUBE_EDITOR="nano" kubectl edit svc/docker-registry
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`
kubectl edit svc/docker-registry --output-version=v1 -o json`
)
var errExit = fmt.Errorf("exit directly")

View File

@ -35,14 +35,14 @@ import (
const (
exec_example = `# Get output from running 'date' from pod 123456-7890, using the first container by default
$ kubectl exec 123456-7890 date
kubectl exec 123456-7890 date
# Get output from running 'date' in ruby-container from pod 123456-7890
$ kubectl exec 123456-7890 -c ruby-container date
kubectl exec 123456-7890 -c ruby-container date
# 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 exec 123456-7890 -c ruby-container -i -t -- bash -il`
kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il`
)
func NewCmdExec(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command {

View File

@ -29,10 +29,10 @@ import (
const (
explainExamples = `# Get the documentation of the resource and its fields
$ kubectl explain pods
kubectl explain pods
# Get the documentation of a specific field of a resource
$ kubectl explain pods.spec.containers`
kubectl explain pods.spec.containers`
explainLong = `Documentation of resources.

View File

@ -47,22 +47,22 @@ via --port and the exposed resource has multiple ports, all will be re-used by t
if no labels are specified, the new service will re-use the labels from the resource it exposes.`
expose_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
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
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
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
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
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`
kubectl expose rs nginx --port=80 --target-port=8000`
)
func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -47,28 +47,28 @@ horizontalpodautoscalers (hpa), serviceaccounts 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.
$ kubectl get pods
kubectl get pods
# List all pods in ps output format with more information (such as node name).
$ kubectl get pods -o wide
kubectl get pods -o wide
# List a single replication controller with specified NAME in ps output format.
$ kubectl get replicationcontroller web
kubectl get replicationcontroller web
# List a single pod in JSON output format.
$ kubectl get -o json pod web-pod-13je7
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
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}} --api-version=v1
kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} --api-version=v1
# List all replication controllers and services together in ps output format.
$ kubectl get rc,services
kubectl get rc,services
# List one or more resources by their type and names.
$ kubectl get rc/web service/frontend pods/web-pod-13je7`
kubectl get rc/web service/frontend pods/web-pod-13je7`
)
// NewCmdGet creates a command object for the generic "get" action, which

View File

@ -48,23 +48,23 @@ A label must begin with a letter or number, and may contain letters, numbers, hy
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'.
$ kubectl label pods foo unhealthy=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
kubectl label --overwrite pods foo status=unhealthy
# Update all pods in the namespace
$ kubectl label pods --all status=unhealthy
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
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
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-`
kubectl label pods foo bar-`
)
func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -36,19 +36,19 @@ import (
const (
logs_example = `# Return snapshot logs from pod nginx with only one container
$ kubectl logs nginx
kubectl logs nginx
# Return snapshot of previous terminated ruby container logs from pod web-1
$ kubectl logs -p -c ruby 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
kubectl logs -f -c ruby web-1
# Display only the most recent 20 lines of output in pod nginx
$ kubectl logs --tail=20 nginx
kubectl logs --tail=20 nginx
# Show all logs from pod nginx written in the last hour
$ kubectl logs --since=1h nginx`
kubectl logs --since=1h nginx`
)
type LogsOptions struct {

View File

@ -33,16 +33,16 @@ import (
const (
portforward_example = `
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
$ kubectl port-forward mypod 5000 6000
kubectl port-forward mypod 5000 6000
# Listen on port 8888 locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod 8888:5000
kubectl port-forward mypod 8888:5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod :5000
kubectl port-forward mypod :5000
# Listen on a random port locally, forwarding to 5000 in the pod
$ kubectl port-forward mypod 0:5000`
kubectl port-forward mypod 0:5000`
)
func NewCmdPortForward(f *cmdutil.Factory) *cobra.Command {

View File

@ -32,15 +32,15 @@ import (
const (
default_port = 8001
proxy_example = `# Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
$ kubectl proxy --port=8011 --www=./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
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`
kubectl proxy --api-prefix=/k8s-api`
)
func NewCmdProxy(f *cmdutil.Factory, out io.Writer) *cobra.Command {

View File

@ -46,10 +46,10 @@ $ 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.`
replace_example = `# Replace a pod using the data in pod.json.
$ kubectl replace -f ./pod.json
kubectl replace -f ./pod.json
# Replace a pod based on the JSON passed into stdin.
$ cat pod.json | kubectl replace -f -
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 -

View File

@ -49,20 +49,20 @@ Replaces the specified replication controller with a new replication controller
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.
$ kubectl rolling-update frontend-v1 -f 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 -
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
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
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
kubectl rolling-update frontend-v1 frontend-v2 --rollback
`
)

View File

@ -26,7 +26,7 @@ import (
const (
rollout_long = `rollout manages a deployment using subcommands like "kubectl rollout undo deployment/abc"`
rollout_example = `# Rollback to the previous deployment
$ kubectl rollout undo deployment/abc`
kubectl rollout undo deployment/abc`
rollout_valid_resources = `Valid resource types include:
* deployments
`

Some files were not shown because too many files have changed in this diff Show More