Merge pull request #10903 from JanetKuo/update-kubectl-get-docs

Update kubectl get command in docs/devel/
This commit is contained in:
Victor Marmol 2015-07-08 09:57:49 -07:00
commit db1b801952

View File

@ -36,14 +36,14 @@ Vagrant will provision each machine in the cluster with all the necessary compon
By default, each VM in the cluster is running Fedora, and all of the Kubernetes services are installed into systemd. By default, each VM in the cluster is running Fedora, and all of the Kubernetes services are installed into systemd.
To access the master or any minion: To access the master or any node:
```sh ```sh
vagrant ssh master vagrant ssh master
vagrant ssh minion-1 vagrant ssh minion-1
``` ```
If you are running more than one minion, you can access the others by: If you are running more than one nodes, you can access the others by:
```sh ```sh
vagrant ssh minion-2 vagrant ssh minion-2
@ -97,12 +97,12 @@ Once your Vagrant machines are up and provisioned, the first thing to do is to c
You may need to build the binaries first, you can do this with ```make``` You may need to build the binaries first, you can do this with ```make```
```sh ```sh
$ ./cluster/kubectl.sh get minions $ ./cluster/kubectl.sh get nodes
NAME LABELS NAME LABELS STATUS
10.245.1.4 <none> kubernetes-minion-0whl kubernetes.io/hostname=kubernetes-minion-0whl Ready
10.245.1.5 <none> kubernetes-minion-4jdf kubernetes.io/hostname=kubernetes-minion-4jdf Ready
10.245.1.3 <none> kubernetes-minion-epbe kubernetes.io/hostname=kubernetes-minion-epbe Ready
``` ```
### Interacting with your Kubernetes cluster with the `kube-*` scripts. ### Interacting with your Kubernetes cluster with the `kube-*` scripts.
@ -153,23 +153,23 @@ cat ~/.kubernetes_vagrant_auth
} }
``` ```
You should now be set to use the `cluster/kubectl.sh` script. For example try to list the minions that you have started with: You should now be set to use the `cluster/kubectl.sh` script. For example try to list the nodes that you have started with:
```sh ```sh
./cluster/kubectl.sh get minions ./cluster/kubectl.sh get nodes
``` ```
### Running containers ### Running containers
Your cluster is running, you can list the minions in your cluster: Your cluster is running, you can list the nodes in your cluster:
```sh ```sh
$ ./cluster/kubectl.sh get minions $ ./cluster/kubectl.sh get nodes
NAME LABELS NAME LABELS STATUS
10.245.2.4 <none> kubernetes-minion-0whl kubernetes.io/hostname=kubernetes-minion-0whl Ready
10.245.2.3 <none> kubernetes-minion-4jdf kubernetes.io/hostname=kubernetes-minion-4jdf Ready
10.245.2.2 <none> kubernetes-minion-epbe kubernetes.io/hostname=kubernetes-minion-epbe Ready
``` ```
Now start running some containers! Now start running some containers!
@ -179,29 +179,31 @@ Before starting a container there will be no pods, services and replication cont
``` ```
$ cluster/kubectl.sh get pods $ cluster/kubectl.sh get pods
NAME IMAGE(S) HOST LABELS STATUS NAME READY STATUS RESTARTS AGE
$ cluster/kubectl.sh get services $ cluster/kubectl.sh get services
NAME LABELS SELECTOR IP PORT NAME LABELS SELECTOR IP(S) PORT(S)
$ cluster/kubectl.sh get replicationcontrollers $ cluster/kubectl.sh get rc
NAME IMAGE(S SELECTOR REPLICAS CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
``` ```
Start a container running nginx with a replication controller and three replicas Start a container running nginx with a replication controller and three replicas
``` ```
$ cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80 $ cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
my-nginx my-nginx nginx run=my-nginx 3
``` ```
When listing the pods, you will see that three containers have been started and are in Waiting state: When listing the pods, you will see that three containers have been started and are in Waiting state:
``` ```
$ cluster/kubectl.sh get pods $ cluster/kubectl.sh get pods
NAME IMAGE(S) HOST LABELS STATUS NAME READY STATUS RESTARTS AGE
781191ff-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.4/10.245.2.4 name=myNginx Waiting my-nginx-389da 1/1 Waiting 0 33s
7813c8bd-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.2/10.245.2.2 name=myNginx Waiting my-nginx-kqdjk 1/1 Waiting 0 33s
78140853-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.3/10.245.2.3 name=myNginx Waiting my-nginx-nyj3x 1/1 Waiting 0 33s
``` ```
You need to wait for the provisioning to complete, you can monitor the minions by doing: You need to wait for the provisioning to complete, you can monitor the minions by doing:
@ -228,17 +230,17 @@ Going back to listing the pods, services and replicationcontrollers, you now hav
``` ```
$ cluster/kubectl.sh get pods $ cluster/kubectl.sh get pods
NAME IMAGE(S) HOST LABELS STATUS NAME READY STATUS RESTARTS AGE
781191ff-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.4/10.245.2.4 name=myNginx Running my-nginx-389da 1/1 Running 0 33s
7813c8bd-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.2/10.245.2.2 name=myNginx Running my-nginx-kqdjk 1/1 Running 0 33s
78140853-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.3/10.245.2.3 name=myNginx Running my-nginx-nyj3x 1/1 Running 0 33s
$ cluster/kubectl.sh get services $ cluster/kubectl.sh get services
NAME LABELS SELECTOR IP PORT NAME LABELS SELECTOR IP(S) PORT(S)
$ cluster/kubectl.sh get replicationcontrollers $ cluster/kubectl.sh get rc
NAME IMAGE(S SELECTOR REPLICAS NAME IMAGE(S) SELECTOR REPLICAS
myNginx nginx name=my-nginx 3 my-nginx nginx run=my-nginx 3
``` ```
We did not start any services, hence there are none listed. But we see three replicas displayed properly. We did not start any services, hence there are none listed. But we see three replicas displayed properly.
@ -248,9 +250,9 @@ You can already play with scaling the replicas with:
```sh ```sh
$ ./cluster/kubectl.sh scale rc my-nginx --replicas=2 $ ./cluster/kubectl.sh scale rc my-nginx --replicas=2
$ ./cluster/kubectl.sh get pods $ ./cluster/kubectl.sh get pods
NAME IMAGE(S) HOST LABELS STATUS NAME READY STATUS RESTARTS AGE
7813c8bd-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.2/10.245.2.2 name=myNginx Running my-nginx-kqdjk 1/1 Running 0 13m
78140853-3ffe-11e4-9036-0800279696e1 nginx 10.245.2.3/10.245.2.3 name=myNginx Running my-nginx-nyj3x 1/1 Running 0 13m
``` ```
Congratulations! Congratulations!