From b7bc56e1fe2c4a9a4dac11563e7477b66a8a4db4 Mon Sep 17 00:00:00 2001 From: Kelsey Hightower Date: Fri, 29 Jul 2016 08:10:34 -0700 Subject: [PATCH] use the expose command to expose the nginx service --- docs/user-guide/quick-start.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/user-guide/quick-start.md b/docs/user-guide/quick-start.md index 00dc999d53..423e701de7 100644 --- a/docs/user-guide/quick-start.md +++ b/docs/user-guide/quick-start.md @@ -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 @@ -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 ```