@@ -46,116 +46,116 @@ external IP address.
4646
47471 . Display information about the Deployment:
4848
49- ``` shell
50- kubectl get deployments hello-world
51- kubectl describe deployments hello-world
52- ```
49+ ``` shell
50+ kubectl get deployments hello-world
51+ kubectl describe deployments hello-world
52+ ```
5353
54541 . Display information about your ReplicaSet objects:
5555
56- ` ` ` shell
57- kubectl get replicasets
58- kubectl describe replicasets
59- ` ` `
56+ ``` shell
57+ kubectl get replicasets
58+ kubectl describe replicasets
59+ ```
6060
61611 . Create a Service object that exposes the deployment:
6262
63- ` ` ` shell
64- kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
65- ` ` `
63+ ``` shell
64+ kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
65+ ```
6666
67671 . Display information about the Service:
6868
69- ` ` ` shell
70- kubectl get services my-service
71- ` ` `
69+ ``` shell
70+ kubectl get services my-service
71+ ```
7272
73- The output is similar to:
73+ The output is similar to:
7474
75- ` ` ` console
76- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
77- my-service LoadBalancer 10.3.245.137 104.198.205.71 8080/TCP 54s
78- ` ` `
75+ ``` console
76+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
77+ my-service LoadBalancer 10.3.245.137 104.198.205.71 8080/TCP 54s
78+ ```
7979
80- {{< note > }}
80+ {{< note >}}
8181
82- The ` type=LoadBalancer` service is backed by external cloud providers, which is not covered in this example, please refer to [this page](/docs/concepts/services-networking/service/# loadbalancer) for the details.
82+ The ` type=LoadBalancer ` service is backed by external cloud providers, which is not covered in this example, please refer to [ this page] ( /docs/concepts/services-networking/service/#loadbalancer ) for the details.
8383
84- {{< /note > }}
84+ {{< /note >}}
8585
86- {{< note > }}
86+ {{< note >}}
8787
88- If the external IP address is shown as \< pending\> , wait for a minute and enter the same command again.
88+ If the external IP address is shown as \< pending\> , wait for a minute and enter the same command again.
8989
90- {{< /note > }}
90+ {{< /note >}}
9191
92921 . Display detailed information about the Service:
9393
94- ` ` ` shell
95- kubectl describe services my-service
96- ` ` `
97-
98- The output is similar to:
99-
100- ` ` ` console
101- Name: my-service
102- Namespace: default
103- Labels: app.kubernetes.io/name=load-balancer-example
104- Annotations: < none>
105- Selector: app.kubernetes.io/name=load-balancer-example
106- Type: LoadBalancer
107- IP: 10.3.245.137
108- LoadBalancer Ingress: 104.198.205.71
109- Port: < unset> 8080/TCP
110- NodePort: < unset> 32377/TCP
111- Endpoints: 10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more...
112- Session Affinity: None
113- Events: < none>
114- ` ` `
115-
116- Make a note of the external IP address (` LoadBalancer Ingress` ) exposed by
117- your service. In this example, the external IP address is 104.198.205.71.
118- Also note the value of ` Port` and ` NodePort` . In this example, the ` Port`
119- is 8080 and the ` NodePort` is 32377.
94+ ``` shell
95+ kubectl describe services my-service
96+ ```
97+
98+ The output is similar to:
99+
100+ ``` console
101+ Name: my-service
102+ Namespace: default
103+ Labels: app.kubernetes.io/name=load-balancer-example
104+ Annotations: <none>
105+ Selector: app.kubernetes.io/name=load-balancer-example
106+ Type: LoadBalancer
107+ IP: 10.3.245.137
108+ LoadBalancer Ingress: 104.198.205.71
109+ Port: <unset> 8080/TCP
110+ NodePort: <unset> 32377/TCP
111+ Endpoints: 10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more...
112+ Session Affinity: None
113+ Events: <none>
114+ ```
115+
116+ Make a note of the external IP address (` LoadBalancer Ingress ` ) exposed by
117+ your service. In this example, the external IP address is 104.198.205.71.
118+ Also note the value of ` Port ` and ` NodePort ` . In this example, the ` Port `
119+ is 8080 and the ` NodePort ` is 32377.
120120
1211211 . In the preceding output, you can see that the service has several endpoints:
122122 10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more. These are internal
123123 addresses of the pods that are running the Hello World application. To
124124 verify these are pod addresses, enter this command:
125125
126- ` ` ` shell
127- kubectl get pods --output=wide
128- ` ` `
126+ ``` shell
127+ kubectl get pods --output=wide
128+ ```
129129
130- The output is similar to:
130+ The output is similar to:
131131
132- ` ` ` console
133- NAME ... IP NODE
134- hello-world-2895499144-1jaz9 ... 10.0.1.6 gke-cluster-1-default-pool-e0b8d269-1afc
135- hello-world-2895499144-2e5uh ... 10.0.1.8 gke-cluster-1-default-pool-e0b8d269-1afc
136- hello-world-2895499144-9m4h1 ... 10.0.0.6 gke-cluster-1-default-pool-e0b8d269-5v7a
137- hello-world-2895499144-o4z13 ... 10.0.1.7 gke-cluster-1-default-pool-e0b8d269-1afc
138- hello-world-2895499144-segjf ... 10.0.2.5 gke-cluster-1-default-pool-e0b8d269-cpuc
139- ` ` `
132+ ``` console
133+ NAME ... IP NODE
134+ hello-world-2895499144-1jaz9 ... 10.0.1.6 gke-cluster-1-default-pool-e0b8d269-1afc
135+ hello-world-2895499144-2e5uh ... 10.0.1.8 gke-cluster-1-default-pool-e0b8d269-1afc
136+ hello-world-2895499144-9m4h1 ... 10.0.0.6 gke-cluster-1-default-pool-e0b8d269-5v7a
137+ hello-world-2895499144-o4z13 ... 10.0.1.7 gke-cluster-1-default-pool-e0b8d269-1afc
138+ hello-world-2895499144-segjf ... 10.0.2.5 gke-cluster-1-default-pool-e0b8d269-cpuc
139+ ```
140140
1411411 . Use the external IP address (` LoadBalancer Ingress ` ) to access the Hello
142142 World application:
143143
144- ` ` ` shell
145- curl http://< external-ip> :< port>
146- ` ` `
144+ ``` shell
145+ curl http://< external-ip> :< port>
146+ ```
147147
148- where ` < external-ip> ` is the external IP address (` LoadBalancer Ingress` )
149- of your Service, and ` < port> ` is the value of ` Port` in your Service
150- description.
151- If you are using minikube, typing ` minikube service my-service` will
152- automatically open the Hello World application in a browser.
148+ where ` <external-ip> ` is the external IP address (` LoadBalancer Ingress ` )
149+ of your Service, and ` <port> ` is the value of ` Port ` in your Service
150+ description.
151+ If you are using minikube, typing ` minikube service my-service ` will
152+ automatically open the Hello World application in a browser.
153153
154- The response to a successful request is a hello message:
154+ The response to a successful request is a hello message:
155155
156- ` ` ` shell
157- Hello Kubernetes!
158- ` ` `
156+ ``` shell
157+ Hello Kubernetes!
158+ ```
159159
160160## {{% heading "cleanup" %}}
161161
0 commit comments