Merge pull request #292 from janetkuo/kubectl-sh-run

Update docs using kubectl.sh run
This commit is contained in:
johndmulhausen 2016-03-31 12:28:34 -07:00
commit 481fb9c313
2 changed files with 30 additions and 29 deletions

View File

@ -51,7 +51,7 @@ You can now use any of the cluster/kubectl.sh commands to interact with your loc
```shell ```shell
cluster/kubectl.sh get pods cluster/kubectl.sh get pods
cluster/kubectl.sh get services cluster/kubectl.sh get services
cluster/kubectl.sh get replicationcontrollers cluster/kubectl.sh get deployments
cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80 cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80
## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal ## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal
@ -65,7 +65,7 @@ cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80
## introspect Kubernetes! ## introspect Kubernetes!
cluster/kubectl.sh get pods cluster/kubectl.sh get pods
cluster/kubectl.sh get services cluster/kubectl.sh get services
cluster/kubectl.sh get replicationcontrollers cluster/kubectl.sh get deployments
``` ```
### Running a user defined pod ### Running a user defined pod
@ -82,7 +82,7 @@ cluster/kubectl.sh create -f docs/user-guide/pod.yaml
Congratulations! Congratulations!
### Troubleshooting ### FAQs
#### I cannot reach service IPs on the network. #### I cannot reach service IPs on the network.
@ -96,10 +96,6 @@ docker installation, this may conflict with IPs for containers. If you find
containers running with IPs in this range, edit hack/local-cluster-up.sh and containers running with IPs in this range, edit hack/local-cluster-up.sh and
change the service-cluster-ip-range flag to something else. change the service-cluster-ip-range flag to something else.
#### I cannot create a replication controller with replica size greater than 1! What gives?
You are running a single node setup. This has the limitation of only supporting a single replica of a given pod. If you are interested in running with larger replica sizes, we encourage you to try the local vagrant setup or one of the cloud providers.
#### I changed Kubernetes code, how do I run it? #### I changed Kubernetes code, how do I run it?
```shell ```shell
@ -110,7 +106,12 @@ hack/local-up-cluster.sh
#### kubectl claims to start a container but `get pods` and `docker ps` don't show it. #### kubectl claims to start a container but `get pods` and `docker ps` don't show it.
One or more of the KUbernetes daemons might've crashed. Tail the logs of each in /tmp. One or more of the Kubernetes daemons might've crashed. Tail the [logs](/docs/admin/cluster-troubleshooting/#looking-at-logs) of each in /tmp.
```shell
$ ls /tmp/kube*.log
$ tail -f /tmp/kube-apiserver.log
```
#### The pods fail to connect to the services by host names #### The pods fail to connect to the services by host names

View File

@ -173,7 +173,7 @@ NAME LABELS
Now start running some containers! Now start running some containers!
You can now use any of the `cluster/kube-*.sh` commands to interact with your VM machines. You can now use any of the `cluster/kube-*.sh` commands to interact with your VM machines.
Before starting a container there will be no pods, services and replication controllers. Before starting a container there will be no Pods, Services and Deployments.
```shell ```shell
$ ./cluster/kubectl.sh get pods $ ./cluster/kubectl.sh get pods
@ -182,11 +182,11 @@ NAME READY STATUS RESTARTS AGE
$ ./cluster/kubectl.sh get services $ ./cluster/kubectl.sh get services
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
$ ./cluster/kubectl.sh get replicationcontrollers $ ./cluster/kubectl.sh get deployments
CONTROLLER CONTAINER(S) 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 Deployment and three replicas
```shell ```shell
$ ./cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80 $ ./cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80
@ -196,10 +196,10 @@ When listing the pods, you will see that three containers have been started and
```shell ```shell
$ ./cluster/kubectl.sh get pods $ ./cluster/kubectl.sh get pods
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
my-nginx-5kq0g 0/1 Pending 0 10s my-nginx-3800858182-4e6pe 0/1 ContainerCreating 0 3s
my-nginx-gr3hh 0/1 Pending 0 10s my-nginx-3800858182-8ko0s 1/1 Running 0 3s
my-nginx-xql4j 0/1 Pending 0 10s my-nginx-3800858182-seu3u 0/1 ContainerCreating 0 3s
``` ```
You need to wait for the provisioning to complete, you can monitor the nodes by doing: You need to wait for the provisioning to complete, you can monitor the nodes by doing:
@ -225,33 +225,33 @@ kubernetes-node-1:
65a3a926f357 kubernetes/pause:latest "/pause" 39 minutes ago Up 39 minutes 0.0.0.0:4194->8080/tcp k8s--net.c5ba7f0e--cadvisor_-_agent.file--342fd561 65a3a926f357 kubernetes/pause:latest "/pause" 39 minutes ago Up 39 minutes 0.0.0.0:4194->8080/tcp k8s--net.c5ba7f0e--cadvisor_-_agent.file--342fd561
``` ```
Going back to listing the pods, services and replicationcontrollers, you now have: Going back to listing the Pods, Services and Deployments, you now have:
```shell ```shell
$ ./cluster/kubectl.sh get pods $ ./cluster/kubectl.sh get pods
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
my-nginx-5kq0g 1/1 Running 0 1m my-nginx-3800858182-4e6pe 1/1 Running 0 40s
my-nginx-gr3hh 1/1 Running 0 1m my-nginx-3800858182-8ko0s 1/1 Running 0 40s
my-nginx-xql4j 1/1 Running 0 1m my-nginx-3800858182-seu3u 1/1 Running 0 40s
$ ./cluster/kubectl.sh get services $ ./cluster/kubectl.sh get services
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
$ ./cluster/kubectl.sh get replicationcontrollers $ ./cluster/kubectl.sh get deployments
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
my-nginx my-nginx nginx run=my-nginx 3 1m my-nginx 3 3 3 3 1m
``` ```
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.
Check the [guestbook](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/guestbook/) application to learn how to create a service. Check the [guestbook](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/examples/guestbook/) application to learn how to create a Service.
You can already play with scaling the replicas with: You can already play with scaling the replicas with:
```shell ```shell
$ ./cluster/kubectl.sh scale rc my-nginx --replicas=2 $ ./cluster/kubectl.sh scale deployments my-nginx --replicas=2
$ ./cluster/kubectl.sh get pods $ ./cluster/kubectl.sh get pods
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
my-nginx-5kq0g 1/1 Running 0 2m my-nginx-3800858182-4e6pe 1/1 Running 0 2m
my-nginx-gr3hh 1/1 Running 0 2m my-nginx-3800858182-8ko0s 1/1 Running 0 2m
``` ```
Congratulations! Congratulations!