Skip to content

Commit

Permalink
use the expose command to expose the nginx service
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed Jul 29, 2016
1 parent 7bd0d94 commit b7bc56e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docs/user-guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ This guide will help you get oriented to Kubernetes and running your first conta
Once your application is packaged into a container and pushed to an image registry, you're ready to deploy it to Kubernetes.
Through integration with some cloud providers (for example Google Compute Engine and AWS EC2), Kubernetes also enables you to request it to provision a public IP address for your application.

For example, [nginx](http://wiki.nginx.org/Main) is a popular HTTP server, with a [pre-built container on Docker hub](https://registry.hub.docker.com/_/nginx/). The [`kubectl run`](/docs/user-guide/kubectl/kubectl_run) command below will create two nginx replicas, listening on port 80, and a public IP address for your application.
For example, [nginx](http://wiki.nginx.org/Main) is a popular HTTP server, with a [pre-built container on Docker hub](https://registry.hub.docker.com/_/nginx/). The [`kubectl run`](/docs/user-guide/kubectl/kubectl_run) commands below will create two nginx replicas, listening on port 80, and a public IP address for your application.

```shell
$ kubectl run my-nginx --image=nginx --replicas=2 --port=80 --expose --service-overrides='{ "spec": { "type": "LoadBalancer" } }'
service "my-nginx" created
$ kubectl run my-nginx --image=nginx --replicas=2 --port=80
deployment "my-nginx" created
```

To expose your service to the public internet, run:

```shell
$ kubectl expose rc my-nginx --target-port=80 --type=LoadBalancer
service "my-nginx" exposed
```

You can see that they are running by:

```shell
Expand All @@ -33,7 +39,7 @@ Kubernetes will ensure that your application keeps running, by automatically res
To find the public IP address assigned to your application, execute:

```shell
$ kubectl get service/my-nginx
$ kubectl get service my-nginx
NAME CLUSTER_IP EXTERNAL_IP PORT(S) AGE
my-nginx 10.179.240.1 25.1.2.3 80/TCP 8s
```
Expand Down

0 comments on commit b7bc56e

Please sign in to comment.