2015-07-12 12:04:52 +08:00
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
2015-07-17 01:02:26 +08:00
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< h2 > PLEASE NOTE: This document applies to the HEAD of the source tree< / h2 >
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
2015-12-15 02:37:38 +08:00
<!-- TAG RELEASE_LINK, added by the munger automatically -->
2015-07-17 01:02:26 +08:00
< strong >
2015-11-04 02:17:57 +08:00
The latest release of this document can be found
[here ](http://releases.k8s.io/release-1.1/docs/getting-started-guides/docker-multinode/testing.md ).
2015-07-17 01:02:26 +08:00
Documentation for other releases can be found at
[releases.k8s.io ](http://releases.k8s.io ).
< / strong >
--
2015-07-14 06:15:35 +08:00
2015-07-12 12:04:52 +08:00
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
2015-07-18 06:35:41 +08:00
2015-04-07 12:47:04 +08:00
## Testing your Kubernetes cluster.
To validate that your node(s) have been added, run:
```sh
kubectl get nodes
```
That should show something like:
2015-07-17 10:01:02 +08:00
2015-07-19 10:05:35 +08:00
```console
2015-06-15 10:38:50 +08:00
NAME LABELS STATUS
10.240.99.26 kubernetes.io/hostname=10.240.99.26 Ready
127.0.0.1 kubernetes.io/hostname=127.0.0.1 Ready
2015-04-07 12:47:04 +08:00
```
2015-09-03 05:51:19 +08:00
If the status of any node is `Unknown` or `NotReady` your cluster is broken, double check that all containers are running properly, and if all else fails, contact us on [Slack ](../../troubleshooting.md#slack ).
2015-04-07 12:47:04 +08:00
### Run an application
2015-07-17 10:01:02 +08:00
2015-04-07 12:47:04 +08:00
```sh
2015-05-22 04:53:10 +08:00
kubectl -s http://localhost:8080 run nginx --image=nginx --port=80
2015-04-07 12:47:04 +08:00
```
2015-07-19 13:58:13 +08:00
now run `docker ps` you should see nginx running. You may need to wait a few minutes for the image to get pulled.
2015-04-07 12:47:04 +08:00
2015-07-14 02:11:34 +08:00
### Expose it as a service
2015-07-17 10:01:02 +08:00
2015-04-07 12:47:04 +08:00
```sh
kubectl expose rc nginx --port=80
```
2015-10-27 08:47:18 +08:00
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP.
2015-07-17 10:01:02 +08:00
2015-10-27 08:47:18 +08:00
```sh
kubectl get svc nginx
```
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
```sh
kubectl get svc nginx --template={{.spec.clusterIP}}
2015-04-07 12:47:04 +08:00
```
2015-10-27 08:47:18 +08:00
Hit the webserver with the first IP (CLUSTER_IP):
2015-07-17 10:01:02 +08:00
2015-04-07 12:47:04 +08:00
```sh
2015-10-27 08:47:18 +08:00
curl < insert-cluster-ip-here >
2015-04-07 12:47:04 +08:00
```
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
2015-07-25 05:52:18 +08:00
### Scaling
2015-04-07 12:47:04 +08:00
Now try to scale up the nginx you created before:
```sh
2015-05-22 05:10:25 +08:00
kubectl scale rc nginx --replicas=3
2015-04-07 12:47:04 +08:00
```
And list the pods
```sh
kubectl get pods
```
2015-05-15 06:12:45 +08:00
You should see pods landing on the newly added machine.
2015-07-14 08:13:09 +08:00
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
2015-05-15 06:12:45 +08:00
[]()
2015-07-14 08:13:09 +08:00
<!-- END MUNGE: GENERATED_ANALYTICS -->