forked from GoogleCloudPlatform/kubernetes-workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local.patch
246 lines (186 loc) · 5.71 KB
/
local.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
*** README.md 2016-04-20 10:13:44.319573454 -0700
--- local.md 2016-04-27 13:44:58.045974793 -0700
***************
*** 7,12 ****
--- 7,21 ----
## Lab
+ ### Mac / Windows
+
+ You'll need to know the IP of the `docker-machine` vm that is your docker host:
+
+ ```
+ docker-machine ip $(docker-machine active)
+ ```
+
+ Use this when browsing to a node IP in place of `localhost` below.
### Pods
***************
*** 47,62 ****
### Service
To access Lobsters from outside the cluster, we'll need a service. The
! service defined in [service.yaml](service.yaml) will route traffic to
! any pod with the label `app: lobsters`, which matches our pod
! definition. The service is for port 80, but routes to the port labeled
! `web` in our pod definition. The `type: LoadBalancer` creates an IP
! external to the cluster in supported environments.
Create the service and pod:
```
! kubectl create -f ./service.yaml,./pod.yaml
```
```
--- 56,71 ----
### Service
To access Lobsters from outside the cluster, we'll need a service. The
! service defined in [service-local.yaml](service-local.yaml) will route
! traffic to any pod with the label `app: lobsters`, which matches our
! pod definition. The service routs to the port labeled `web` in our pod
! definition. The `type: NodePort` line allows traffic on a particular
! port of each node to be routed to the service.
Create the service and pod:
```
! kubectl create -f ./service-local.yaml,./pod.yaml
```
```
***************
*** 64,82 ****
pod "lobsters" created
```
! Wait for the external IP:
```
! kubectl get svc lobsters
```
```
! NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
! lobsters 10.3.253.158 1.2.3.4 80/TCP 1m
```
! Check that it is working by visiting the external IP in your browser.
!
Delete
--- 73,90 ----
pod "lobsters" created
```
! Check the service's node port, yours will be different:
```
! kubectl get svc lobsters -o yaml | grep nodePort
```
```
! - nodePort: 31618
```
! Check that it is working by visiting the node IP with the port you
! found `http://localhost:31618/`
Delete
***************
*** 105,111 ****
Start lobsters using an RC, use the same service definition:
```
! kubectl create -f ./rc.yaml,./service.yaml
```
```
--- 113,119 ----
Start lobsters using an RC, use the same service definition:
```
! kubectl create -f ./rc.yaml,./service-local.yaml
```
```
***************
*** 113,130 ****
service "lobsters" created
```
! Wait for the external IP:
```
! kubectl get svc lobsters
```
```
! NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
! lobsters 10.3.253.158 1.2.3.4 80/TCP 1m
```
! Check that it is working by visiting the external IP in your browser.
Now, look at the pod
--- 121,138 ----
service "lobsters" created
```
! Check the service's node port, yours will be different:
```
! kubectl get svc lobsters -o yaml | grep nodePort
```
```
! - nodePort: 31618
```
! Check that it is working by visiting the node IP with the port you
! found `http://localhost:31618/`
Now, look at the pod
***************
*** 134,141 ****
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-jf0xs 1/1 Running 0 2m gke-myclus-2f1fdf58-node-lfaa
```
This pod was created by the replication controller. Try deleting the
--- 142,149 ----
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-tx1sa 1/1 Running 0 21s 127.0.0.1
```
This pod was created by the replication controller. Try deleting the
***************
*** 156,166 ****
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-t1vwk 1/1 Running 0 6s gke-myclus-2f1fdf58-node-lfaa
```
! A new pod was created! It might even be on a different node.
Scaling is as easy as:
--- 164,174 ----
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-l5fq3 1/1 Running 0 1s 127.0.0.1
```
! A new pod was created!
Scaling is as easy as:
***************
*** 179,190 ****
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-32ona 1/1 Running 0 26s gke-myclus-2f1fdf58-node-lfaa
! lobsters-8twm0 1/1 Running 0 2m gke-myclus-2f1fdf58-node-lfaa
! lobsters-hhves 0/1 ContainerCreating 0 26s gke-myclus-2f1fdf58-node-kxe4
! lobsters-lv5km 0/1 ContainerCreating 0 26s gke-myclus-2f1fdf58-node-bvxp
! lobsters-tlojp 0/1 ContainerCreating 0 26s gke-myclus-2f1fdf58-node-bvxp
```
Also the RC
--- 187,198 ----
```
```
! NAME READY STATUS RESTARTS AGE NODE
! lobsters-9ijsi 1/1 Running 0 6s 127.0.0.1
! lobsters-l5fq3 1/1 Running 0 36s 127.0.0.1
! lobsters-pfnlj 1/1 Running 0 6s 127.0.0.1
! lobsters-sceuy 1/1 Running 0 6s 127.0.0.1
! lobsters-txgwb 1/1 Running 0 6s 127.0.0.1
```
Also the RC
***************
*** 230,236 ****
RC declaration.
```
! kubectl create -f ./dep.yaml,./service.yaml
```
```
--- 238,244 ----
RC declaration.
```
! kubectl create -f ./dep.yaml,./service-local.yaml
```
```
***************
*** 292,295 ****
```
kubectl delete pod,rc,svc,deployment -l app=lobsters
```
-
--- 300,302 ----