From 221c38d62d29ec2fc87a82288d10196de8a88536 Mon Sep 17 00:00:00 2001 From: Jonathan Katora Date: Sun, 6 May 2018 15:16:50 -0400 Subject: [PATCH] Update load-balance-access-application-cluster.md (#8351) * Update load-balance-access-application-cluster.md * Update load-balance-access-application-cluster.md removed unnecessary code highlights. --- ...load-balance-access-application-cluster.md | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/content/en/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md b/content/en/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md index 585c3eab56..8af41dc6a8 100644 --- a/content/en/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md +++ b/content/en/docs/tasks/access-application-cluster/load-balance-access-application-cluster.md @@ -33,37 +33,38 @@ load-balanced access to an application running in a cluster. 1. Run a Hello World application in your cluster: + ``` kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080 - + ``` + 1. List the pods that are running the Hello World application: + ``` kubectl get pods --selector="run=load-balancer-example" + ``` The output is similar to this: + ``` NAME READY STATUS RESTARTS AGE hello-world-2189936611-8fyp0 1/1 Running 0 6m hello-world-2189936611-9isq8 1/1 Running 0 6m + ``` -1. List the replica set for the two Hello World pods: +1. Create a Service object that exposes the deployment: - kubectl get replicasets --selector="run=load-balancer-example" + ``` + kubectl expose deployment --type=NodePort --name=example-service + ``` - The output is similar to this: - - NAME DESIRED CURRENT AGE - hello-world-2189936611 2 2 12m - -1. Create a Service object that exposes the replica set: - - kubectl expose rs --type="LoadBalancer" --name="example-service" - - where `` is the name of your replica set. + where `` is the name of your deployment. 1. Display the IP addresses for your service: + ``` kubectl get services example-service - + ``` + The output shows the internal IP address and the external IP address of your service. If the external IP address shows as ``, repeat the command. @@ -78,26 +79,26 @@ load-balanced access to an application running in a cluster. curl :8080 - where `` is the external IP address of your - service. + where `` is the external IP address of your + service. - The output is a hello message from the application: + The output is a hello message from the application: Hello Kubernetes! - Note: If you are using Minikube, enter these commands: + Note: If you are using Minikube, enter these commands: kubectl cluster-info kubectl describe services example-service - The output displays the IP address of your Minikube node and the NodePort - value for your service. Then enter this command to access the Hello World - application: + The output displays the IP address of your Minikube node and the NodePort + value for your service. Then enter this command to access the Hello World + application: curl : - where `` us the IP address of your Minikube node, - and `` is the NodePort value for your service. + where `` us the IP address of your Minikube node, + and `` is the NodePort value for your service. ## Using a service configuration file