mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #12593 from apeeyush/docs-bash-comments
Use bash comments in kubectl examples
This commit is contained in:
commit
ead7b37616
@ -137,14 +137,14 @@ Attach to a a process that is already running inside an existing container.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// get output from running pod 123456\-7890, using the first container by default
|
# 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
|
# get output from ruby\-container from pod 123456\-7890
|
||||||
$ kubectl attach 123456\-7890 \-c ruby\-container date
|
$ kubectl attach 123456\-7890 \-c ruby\-container date
|
||||||
|
|
||||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby\-container from pod 123456\-780
|
# 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
|
# 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
|
.fi
|
||||||
|
@ -130,13 +130,13 @@ Specifying a name that already exists will merge new fields on top of existing v
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Set only the server field on the e2e cluster entry without touching other values.
|
# 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
|
# 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
|
# 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
|
.fi
|
||||||
|
@ -126,7 +126,7 @@ Specifying a name that already exists will merge new fields on top of existing v
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Set the user field on the gce context entry without touching other values
|
# 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
|
.fi
|
||||||
|
@ -145,14 +145,14 @@ Bearer token and basic auth are mutually exclusive.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Set only the "client\-key" field on the "cluster\-admin"
|
# Set only the "client\-key" field on the "cluster\-admin"
|
||||||
// entry, without touching other values:
|
# 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
|
# 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
|
# 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
|
.fi
|
||||||
|
@ -161,10 +161,10 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Show Merged kubeconfig settings.
|
# Show Merged kubeconfig settings.
|
||||||
$ kubectl config view
|
$ 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}}'
|
$ kubectl config view \-o template \-\-template='{{range .users}}{{ if eq .name "e2e" }}{{ index .user.password }}{{end}}{{end}}'
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -136,10 +136,10 @@ JSON and YAML formats are accepted.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Create a pod using the data in pod.json.
|
# 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.
|
# Create a pod based on the JSON passed into stdin.
|
||||||
$ cat pod.json | kubectl create \-f \-
|
$ cat pod.json | kubectl create \-f \-
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -168,19 +168,19 @@ will be lost along with the rest of the resource.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Delete a pod using the type and name specified in pod.json.
|
# 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.
|
# 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 label name=myLabel.
|
# 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.
|
# 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
|
# Delete all pods
|
||||||
$ kubectl delete pods \-\-all
|
$ kubectl delete pods \-\-all
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -150,23 +150,23 @@ namespaces (ns) or secrets.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Describe a node
|
# Describe a node
|
||||||
$ kubectl describe nodes kubernetes\-minion\-emt8.c.myproject.internal
|
$ kubectl describe nodes kubernetes\-minion\-emt8.c.myproject.internal
|
||||||
|
|
||||||
// Describe a pod
|
# Describe a pod
|
||||||
$ kubectl describe pods/nginx
|
$ 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
|
$ kubectl describe \-f pod.json
|
||||||
|
|
||||||
// Describe all pods
|
# Describe all pods
|
||||||
$ kubectl describe pods
|
$ kubectl describe pods
|
||||||
|
|
||||||
// Describe pods by label name=myLabel
|
# 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
|
# 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).
|
# get the name of the rc as a prefix in the pod the name).
|
||||||
$ kubectl describe pods frontend
|
$ kubectl describe pods frontend
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -141,14 +141,14 @@ Execute a command in a container.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// get output from running 'date' from pod 123456\-7890, using the first container by default
|
# 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
|
# 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\-780
|
# 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
|
# 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
|
.fi
|
||||||
|
@ -207,16 +207,16 @@ re\-use the labels from the resource it exposes.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Creates a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
# 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
|
$ 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.
|
# 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
|
$ 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
|
$ 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
|
$ kubectl expose rc streamer \-\-port=4100 \-\-protocol=udp \-\-name=video\-stream
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -172,25 +172,25 @@ of the \-\-template flag, you can filter the attributes of the fetched resource(
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// List all pods in ps output format.
|
# 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).
|
# 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.
|
# 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.
|
# List a single pod in JSON output format.
|
||||||
$ kubectl get \-o json pod web\-pod\-13je7
|
$ 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
|
$ 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
|
$ 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
|
$ kubectl get rc/web service/frontend pods/web\-pod\-13je7
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -163,20 +163,20 @@ If \-\-resource\-version is specified, then updates will use this resource versi
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Update pod 'foo' with the label 'unhealthy' and the value 'true'.
|
# 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.
|
# 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
|
# Update all pods in the namespace
|
||||||
$ kubectl label pods \-\-all status=unhealthy
|
$ 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
|
$ kubectl label pods foo status=unhealthy \-\-resource\-version=1
|
||||||
|
|
||||||
// Update pod 'foo' by removing a label named 'bar' if it exists.
|
# Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||||
// Does not require the \-\-overwrite flag.
|
# Does not require the \-\-overwrite flag.
|
||||||
$ kubectl label pods foo bar\-
|
$ kubectl label pods foo bar\-
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -141,13 +141,13 @@ Print the logs for a container in a pod. If the pod has only one container, the
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Returns snapshot of ruby\-container logs from pod 123456\-7890.
|
# Returns snapshot of ruby\-container logs from pod 123456\-7890.
|
||||||
$ kubectl logs 123456\-7890 ruby\-container
|
$ 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
|
$ 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
|
$ kubectl logs \-f 123456\-7890 ruby\-container
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -141,10 +141,10 @@ Please refer to the models in
|
|||||||
|
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
// 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}}'
|
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"}]}}'
|
kubectl patch pod valid\-pod \-p '{"spec":{"containers":[{"name":"kubernetes\-serve\-hostname","image":"new image"}]}}'
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -130,16 +130,16 @@ Forward one or more local ports to a pod.
|
|||||||
|
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
// 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
|
$ 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
|
$ 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
|
$ 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
|
$ kubectl port\-forward mypod 0:5000
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -186,15 +186,15 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
|
# 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.
|
# Run a proxy to kubernetes apiserver on an arbitrary local port.
|
||||||
// The chosen port for the server will be output to stdout.
|
# 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
|
# 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/
|
# 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
|
.fi
|
||||||
|
@ -158,16 +158,16 @@ Please refer to the models in
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Replace a pod using the data in pod.json.
|
# 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.
|
# 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
|
# 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 \-
|
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
|
kubectl replace \-\-force \-f ./pod.json
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -179,17 +179,17 @@ existing replication controller and overwrite at least one (common) label in its
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Update pods of frontend\-v1 using new replication controller data in frontend\-v2.json.
|
# 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.
|
# 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
|
# Update the pods of frontend\-v1 to frontend\-v2 by just changing the image, and switching the
|
||||||
// name of the replication controller.
|
# 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
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,16 +191,16 @@ Creates a replication controller to manage the created container(s).
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Starts a single instance of nginx.
|
# Starts a single instance of nginx.
|
||||||
$ kubectl run nginx \-\-image=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
|
$ 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
|
$ 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": { ... } }'
|
$ kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -151,13 +151,13 @@ scale is sent to the server.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Scale replication controller named 'foo' to 3.
|
# Scale replication controller named 'foo' to 3.
|
||||||
$ kubectl scale \-\-replicas=3 replicationcontrollers foo
|
$ 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
|
$ 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
|
$ kubectl scale \-\-replicas=5 rc/foo rc/bar
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -161,16 +161,16 @@ If the resource is scalable it will be scaled to 0 before deletion.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
// Shut down foo.
|
# Shut down foo.
|
||||||
$ kubectl stop replicationcontroller 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
|
$ 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
|
$ 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
|
$ kubectl stop \-f path/to/resources
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
@ -47,14 +47,14 @@ kubectl attach POD -c CONTAINER
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// get output from running pod 123456-7890, using the first container by default
|
# 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
|
# get output from ruby-container from pod 123456-7890
|
||||||
$ kubectl attach 123456-7890 -c ruby-container date
|
$ kubectl attach 123456-7890 -c ruby-container date
|
||||||
|
|
||||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
# 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
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ $ kubectl attach 123456-7890 -c ruby-container -i -t
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.874171127 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.552121602 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -48,13 +48,13 @@ kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Set only the server field on the e2e cluster entry without touching other values.
|
# 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
|
# 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
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true
|
|||||||
|
|
||||||
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.87626611 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.5536843 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -48,7 +48,7 @@ kubectl config set-context NAME [--cluster=cluster_nickname] [--user=user_nickna
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Set the user field on the gce context entry without touching other values
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ $ kubectl config set-context gce --user=cluster-admin
|
|||||||
|
|
||||||
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.876621894 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.553957807 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -60,14 +60,14 @@ kubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--c
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Set only the "client-key" field on the "cluster-admin"
|
# Set only the "client-key" field on the "cluster-admin"
|
||||||
// entry, without touching other values:
|
# 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
|
# 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
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ $ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admi
|
|||||||
|
|
||||||
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.876445802 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.553818643 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -49,10 +49,10 @@ kubectl config view
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Show Merged kubeconfig settings.
|
# Show Merged kubeconfig settings.
|
||||||
$ kubectl config view
|
$ 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}}'
|
$ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2e" }}{{ index .user.password }}{{end}}{{end}}'
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2
|
|||||||
|
|
||||||
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 19:25:02.005424182 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.553558331 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -49,10 +49,10 @@ kubectl create -f FILENAME
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Create a pod using the data in pod.json.
|
# 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.
|
# Create a pod based on the JSON passed into stdin.
|
||||||
$ cat pod.json | kubectl create -f -
|
$ cat pod.json | kubectl create -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ $ cat pod.json | kubectl create -f -
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.872168232 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.550238308 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -55,19 +55,19 @@ kubectl delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Delete a pod using the type and name specified in pod.json.
|
# 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.
|
# 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 label name=myLabel.
|
# 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.
|
# 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
|
# Delete all pods
|
||||||
$ kubectl delete pods --all
|
$ kubectl delete pods --all
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ $ kubectl delete pods --all
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 23:27:50.885990004 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.550716188 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -60,23 +60,23 @@ kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Describe a node
|
# Describe a node
|
||||||
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
|
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
|
||||||
|
|
||||||
// Describe a pod
|
# Describe a pod
|
||||||
$ kubectl describe pods/nginx
|
$ 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
|
$ kubectl describe -f pod.json
|
||||||
|
|
||||||
// Describe all pods
|
# Describe all pods
|
||||||
$ kubectl describe pods
|
$ kubectl describe pods
|
||||||
|
|
||||||
// Describe pods by label name=myLabel
|
# 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
|
# 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).
|
# get the name of the rc as a prefix in the pod the name).
|
||||||
$ kubectl describe pods frontend
|
$ kubectl describe pods frontend
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ $ kubectl describe pods frontend
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-12 07:26:58.783477397 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 17:00:51.070612795 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -47,14 +47,14 @@ kubectl exec POD -c CONTAINER -- COMMAND [args...]
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// get output from running 'date' from pod 123456-7890, using the first container by default
|
# 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
|
# 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-780
|
# 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
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ $ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.874366729 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.552259405 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -51,16 +51,16 @@ kubectl expose (-f FILENAME | TYPE NAME) --port=port [--protocol=TCP|UDP] [--tar
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Creates a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
# 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
|
$ 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.
|
# 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
|
$ 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
|
$ 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
|
$ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-12 08:16:20.804863501 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 17:00:51.073556749 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -55,25 +55,25 @@ kubectl get [(-o|--output=)json|yaml|template|wide|...] (TYPE [(NAME | -l label]
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// List all pods in ps output format.
|
# 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).
|
# 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.
|
# 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.
|
# List a single pod in JSON output format.
|
||||||
$ kubectl get -o json pod web-pod-13je7
|
$ 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
|
$ 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
|
$ 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
|
$ kubectl get rc/web service/frontend pods/web-pod-13je7
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 19:25:01.995301464 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.549908733 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -51,20 +51,20 @@ kubectl label [--overwrite] TYPE NAME KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-ve
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Update pod 'foo' with the label 'unhealthy' and the value 'true'.
|
# 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.
|
# 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
|
# Update all pods in the namespace
|
||||||
$ kubectl label pods --all status=unhealthy
|
$ 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
|
$ kubectl label pods foo status=unhealthy --resource-version=1
|
||||||
|
|
||||||
// Update pod 'foo' by removing a label named 'bar' if it exists.
|
# Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||||
// Does not require the --overwrite flag.
|
# Does not require the --overwrite flag.
|
||||||
$ kubectl label pods foo bar-
|
$ kubectl label pods foo bar-
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ $ kubectl label pods foo bar-
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 19:25:02.004743482 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.553249869 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -47,13 +47,13 @@ kubectl logs [-f] [-p] POD [-c CONTAINER]
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Returns snapshot of ruby-container logs from pod 123456-7890.
|
# Returns snapshot of ruby-container logs from pod 123456-7890.
|
||||||
$ kubectl logs 123456-7890 ruby-container
|
$ 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
|
$ 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
|
$ kubectl logs -f 123456-7890 ruby-container
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ $ kubectl logs -f 123456-7890 ruby-container
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.873022075 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.55101853 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -52,10 +52,10 @@ kubectl patch TYPE NAME -p PATCH
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
// 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}}'
|
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"}]}}'
|
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 09:20:43.877286912 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.550556305 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -48,16 +48,16 @@ kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
// 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
|
$ 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
|
$ 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
|
$ 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
|
$ kubectl port-forward mypod 0:5000
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ $ kubectl port-forward mypod 0:5000
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 09:20:43.879885036 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.552397633 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -62,15 +62,15 @@ kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-pref
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/
|
# 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.
|
# Run a proxy to kubernetes apiserver on an arbitrary local port.
|
||||||
// The chosen port for the server will be output to stdout.
|
# 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
|
# 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/
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ $ kubectl proxy --api-prefix=/k8s-api
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 14:22:30.874751273 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.55255853 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -53,16 +53,16 @@ kubectl replace -f FILENAME
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Replace a pod using the data in pod.json.
|
# 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.
|
# 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
|
# 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 -
|
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
|
kubectl replace --force -f ./pod.json
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ kubectl replace --force -f ./pod.json
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-10 16:02:35.925298963 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.550406842 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -51,17 +51,17 @@ kubectl rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CO
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
|
# 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.
|
# 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
|
# Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the
|
||||||
// name of the replication controller.
|
# 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
|
# 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
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -117,7 +117,7 @@ $ kubectl rolling-update frontend --image=image:v2
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-10 14:26:04.707001372 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.55183074 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -48,16 +48,16 @@ kubectl run NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bo
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Starts a single instance of nginx.
|
# Starts a single instance of nginx.
|
||||||
$ kubectl run nginx --image=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
|
$ 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
|
$ 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": { ... } }'
|
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ $ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { .
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-07 19:25:02.003600767 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.552754871 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -52,13 +52,13 @@ kubectl scale [--resource-version=version] [--current-replicas=count] --replicas
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Scale replication controller named 'foo' to 3.
|
# Scale replication controller named 'foo' to 3.
|
||||||
$ kubectl scale --replicas=3 replicationcontrollers foo
|
$ 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
|
$ 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
|
$ kubectl scale --replicas=5 rc/foo rc/bar
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ $ kubectl scale --replicas=5 rc/foo rc/bar
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 23:27:50.886701916 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.551986915 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -53,16 +53,16 @@ kubectl stop (-f FILENAME | TYPE (NAME | -l label | --all))
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
// Shut down foo.
|
# Shut down foo.
|
||||||
$ kubectl stop replicationcontroller 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
|
$ 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
|
$ 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
|
$ kubectl stop -f path/to/resources
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ $ kubectl stop -f path/to/resources
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-08-05 23:27:50.888354767 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-08-12 16:38:35.552901364 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -33,14 +33,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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
|
$ 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
|
$ kubectl attach 123456-7890 -c ruby-container date
|
||||||
|
|
||||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
# 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
|
# 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`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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.
|
Bearer token and basic auth are mutually exclusive.
|
||||||
`, clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword)
|
`, clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword)
|
||||||
|
|
||||||
const create_authinfo_example = `// Set only the "client-key" field on the "cluster-admin"
|
const create_authinfo_example = `# Set only the "client-key" field on the "cluster-admin"
|
||||||
// entry, without touching other values:
|
# 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
|
# 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
|
# 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 {
|
func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Command {
|
||||||
|
@ -43,13 +43,13 @@ type createClusterOptions struct {
|
|||||||
const (
|
const (
|
||||||
create_cluster_long = `Sets a cluster entry in kubeconfig.
|
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.`
|
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
|
$ 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
|
$ 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`
|
$ kubectl config set-cluster e2e --insecure-skip-tls-verify=true`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ type createContextOptions struct {
|
|||||||
const (
|
const (
|
||||||
create_context_long = `Sets a context entry in kubeconfig
|
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.`
|
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`
|
$ kubectl config set-context gce --user=cluster-admin`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ const (
|
|||||||
view_long = `displays Merged kubeconfig settings or a specified kubeconfig file.
|
view_long = `displays Merged kubeconfig settings or a specified kubeconfig file.
|
||||||
|
|
||||||
You can use --output=template --template=TEMPLATE to extract specific values.`
|
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
|
$ 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}}'`
|
$ 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.
|
create_long = `Create a resource by filename or stdin.
|
||||||
|
|
||||||
JSON and YAML formats are accepted.`
|
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
|
$ 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 -`
|
$ 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
|
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
|
submits an update to a resource right when you submit a delete, their update
|
||||||
will be lost along with the rest of the resource.`
|
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
|
$ 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 -
|
$ 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
|
$ 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
|
$ kubectl delete pod 1234-56-7890-234234-456456
|
||||||
|
|
||||||
// Delete all pods
|
# Delete all pods
|
||||||
$ kubectl delete pods --all`
|
$ 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),
|
replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
|
||||||
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota),
|
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota),
|
||||||
namespaces (ns) or secrets.`
|
namespaces (ns) or secrets.`
|
||||||
describe_example = `// Describe a node
|
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
|
# Describe a pod
|
||||||
$ kubectl describe pods/nginx
|
$ 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
|
$ kubectl describe -f pod.json
|
||||||
|
|
||||||
// Describe all pods
|
# Describe all pods
|
||||||
$ kubectl describe pods
|
$ kubectl describe pods
|
||||||
|
|
||||||
// Describe pods by label name=myLabel
|
# 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
|
# 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).
|
# get the name of the rc as a prefix in the pod the name).
|
||||||
$ kubectl describe pods frontend`
|
$ kubectl describe pods frontend`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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
|
$ 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
|
$ kubectl exec 123456-7890 -c ruby-container date
|
||||||
|
|
||||||
// switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
|
# 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
|
# 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`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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
|
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.`
|
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
|
$ 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.
|
# 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
|
$ 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
|
$ 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`
|
$ 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
|
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).`
|
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
|
$ 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
|
$ 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
|
$ 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
|
$ 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
|
$ 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
|
$ 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`
|
$ 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.
|
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 --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.`
|
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
|
$ 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
|
$ 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
|
$ 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
|
$ kubectl label pods foo status=unhealthy --resource-version=1
|
||||||
|
|
||||||
// Update pod 'foo' by removing a label named 'bar' if it exists.
|
# Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||||
// Does not require the --overwrite flag.
|
# Does not require the --overwrite flag.
|
||||||
$ kubectl label pods foo bar-`
|
$ kubectl label pods foo bar-`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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
|
$ 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
|
$ 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`
|
$ 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.`
|
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 = `
|
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}}'
|
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"}]}}'`
|
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,16 +30,16 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
portforward_example = `
|
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
|
$ 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
|
$ 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
|
$ 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`
|
$ kubectl port-forward mypod 0:5000`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,15 +31,15 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
default_port = 8001
|
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/
|
$ kubectl proxy --port=8011 --www=./local/www/
|
||||||
|
|
||||||
// Run a proxy to kubernetes apiserver on an arbitrary local port.
|
# Run a proxy to kubernetes apiserver on an arbitrary local port.
|
||||||
// The chosen port for the server will be output to stdout.
|
# 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
|
# 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/
|
# 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`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,16 +39,16 @@ complete resource spec must be provided. This can be obtained by
|
|||||||
$ kubectl get TYPE NAME -o yaml
|
$ 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.`
|
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
|
$ 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 -
|
$ 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 -
|
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`
|
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
|
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
|
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.`
|
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
|
$ 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 -
|
$ 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
|
# Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the
|
||||||
// name of the replication controller.
|
# 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
|
# 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
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
@ -34,16 +34,16 @@ import (
|
|||||||
const (
|
const (
|
||||||
run_long = `Create and run a particular image, possibly replicated.
|
run_long = `Create and run a particular image, possibly replicated.
|
||||||
Creates a replication controller to manage the created container(s).`
|
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
|
$ kubectl run nginx --image=nginx
|
||||||
|
|
||||||
// Starts a replicated instance of nginx.
|
# Starts 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.
|
# 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 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": { ... } }'`
|
$ 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
|
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 attempted, and it is guaranteed that the precondition holds true when the
|
||||||
scale is sent to the server.`
|
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
|
$ 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
|
$ 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`
|
$ 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.
|
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.`
|
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
|
$ 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
|
$ 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
|
$ 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`
|
$ kubectl stop -f path/to/resources`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user