@@ -46,116 +46,116 @@ external IP address.
46
46
47
47
1 . Display information about the Deployment:
48
48
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
+ ```
53
53
54
54
1 . Display information about your ReplicaSet objects:
55
55
56
- ` ` ` shell
57
- kubectl get replicasets
58
- kubectl describe replicasets
59
- ` ` `
56
+ ``` shell
57
+ kubectl get replicasets
58
+ kubectl describe replicasets
59
+ ```
60
60
61
61
1 . Create a Service object that exposes the deployment:
62
62
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
+ ```
66
66
67
67
1 . Display information about the Service:
68
68
69
- ` ` ` shell
70
- kubectl get services my-service
71
- ` ` `
69
+ ``` shell
70
+ kubectl get services my-service
71
+ ```
72
72
73
- The output is similar to:
73
+ The output is similar to:
74
74
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
+ ```
79
79
80
- {{< note > }}
80
+ {{< note >}}
81
81
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.
83
83
84
- {{< /note > }}
84
+ {{< /note >}}
85
85
86
- {{< note > }}
86
+ {{< note >}}
87
87
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.
89
89
90
- {{< /note > }}
90
+ {{< /note >}}
91
91
92
92
1 . Display detailed information about the Service:
93
93
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.
120
120
121
121
1 . In the preceding output, you can see that the service has several endpoints:
122
122
10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more. These are internal
123
123
addresses of the pods that are running the Hello World application. To
124
124
verify these are pod addresses, enter this command:
125
125
126
- ` ` ` shell
127
- kubectl get pods --output=wide
128
- ` ` `
126
+ ``` shell
127
+ kubectl get pods --output=wide
128
+ ```
129
129
130
- The output is similar to:
130
+ The output is similar to:
131
131
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
+ ```
140
140
141
141
1 . Use the external IP address (` LoadBalancer Ingress ` ) to access the Hello
142
142
World application:
143
143
144
- ` ` ` shell
145
- curl http://< external-ip> :< port>
146
- ` ` `
144
+ ``` shell
145
+ curl http://< external-ip> :< port>
146
+ ```
147
147
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.
153
153
154
- The response to a successful request is a hello message:
154
+ The response to a successful request is a hello message:
155
155
156
- ` ` ` shell
157
- Hello Kubernetes!
158
- ` ` `
156
+ ``` shell
157
+ Hello Kubernetes!
158
+ ```
159
159
160
160
## {{% heading "cleanup" %}}
161
161
0 commit comments