File tree Expand file tree Collapse file tree 1 file changed +3
-26
lines changed
kubernetes/beginners/workshop/lab00-running-nginx-pod Expand file tree Collapse file tree 1 file changed +3
-26
lines changed Original file line number Diff line number Diff line change @@ -134,39 +134,16 @@ kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d
134
134
nginx ClusterIP 10.105.96.0 <none> 80/TCP 20h
135
135
```
136
136
137
- ## Exposing your pods to the internet
137
+ ## Accessing it through localhost
138
138
139
139
```
140
- Ajeets-MacBook-Air:~ ajeetraina$ kubectl expose deployment my-nginx --port=80
141
- service "my-nginx" exposed
142
- Ajeets-MacBook-Air:~ ajeetraina$ kubectl get services
143
- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
144
- example-service NodePort 10.106.252.68 <none> 8080:31477/TCP 19h
145
- kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d
146
- my-nginx ClusterIP 10.101.119.153 <none> 80/TCP 4s
140
+ IP=$(kubectl get svc my-nginx -o go-template --template '{{ .spec.clusterIP }}')
147
141
```
148
142
149
- ## Introspection
150
-
151
143
```
152
- [node1 lab01-creating-nginx-pod]$ kubectl get pods
153
- NAME READY STATUS RESTARTS AGE
154
- my-nginx-7b64f649-258lb 1/1 Running 0 8m43s
155
- my-nginx-7b64f649-8zcdr 1/1 Running 0 8m43s
144
+ curl $IP:80
156
145
```
157
146
158
- ```
159
- [node1 lab01-creating-nginx-pod]$ kubectl get services
160
- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
161
- kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 33m
162
- my-nginx ClusterIP 10.106.231.19 <none> 80/TCP 4m47s
163
- ```
164
-
165
- ```
166
- [node1 lab01-creating-nginx-pod]$ kubectl get deployments
167
- NAME READY UP-TO-DATE AVAILABLE AGE
168
- my-nginx 2/2 2 2 8m45s
169
- ```
170
147
171
148
## Cleaning Up
172
149
You can’t perform that action at this time.
0 commit comments