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.
This commit is contained in:
committed by
k8s-ci-robot
parent
f0a4d99389
commit
221c38d62d
+13
-12
@@ -33,36 +33,37 @@ load-balanced access to an application running in a cluster.
|
|||||||
|
|
||||||
1. Run a Hello World application in your 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
|
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:
|
1. List the pods that are running the Hello World application:
|
||||||
|
|
||||||
|
```
|
||||||
kubectl get pods --selector="run=load-balancer-example"
|
kubectl get pods --selector="run=load-balancer-example"
|
||||||
|
```
|
||||||
|
|
||||||
The output is similar to this:
|
The output is similar to this:
|
||||||
|
|
||||||
|
```
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
hello-world-2189936611-8fyp0 1/1 Running 0 6m
|
hello-world-2189936611-8fyp0 1/1 Running 0 6m
|
||||||
hello-world-2189936611-9isq8 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 <your-deployment-name> --type=NodePort --name=example-service
|
||||||
|
```
|
||||||
|
|
||||||
The output is similar to this:
|
where `<your-deployment-name>` is the name of your deployment.
|
||||||
|
|
||||||
NAME DESIRED CURRENT AGE
|
|
||||||
hello-world-2189936611 2 2 12m
|
|
||||||
|
|
||||||
1. Create a Service object that exposes the replica set:
|
|
||||||
|
|
||||||
kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
|
|
||||||
|
|
||||||
where `<your-replica-set-name>` is the name of your replica set.
|
|
||||||
|
|
||||||
1. Display the IP addresses for your service:
|
1. Display the IP addresses for your service:
|
||||||
|
|
||||||
|
```
|
||||||
kubectl get services example-service
|
kubectl get services example-service
|
||||||
|
```
|
||||||
|
|
||||||
The output shows the internal IP address and the external IP address of
|
The output shows the internal IP address and the external IP address of
|
||||||
your service. If the external IP address shows as `<pending>`, repeat the
|
your service. If the external IP address shows as `<pending>`, repeat the
|
||||||
|
|||||||
Reference in New Issue
Block a user