You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -136,6 +139,14 @@ You can also run `k describe po POD_NAME`
136
139
`k delete po nm`
137
140
</b></details>
138
141
142
+
<details>
143
+
<summary>List all the pods with the label "env=prod"</summary><br><b>
144
+
145
+
`k get po -l env=prod`
146
+
147
+
To count them: `k get po -l env=prod --no-headers | wc -l`
148
+
</b></details>
149
+
139
150
### Troubleshooting Pods
140
151
141
152
<details>
@@ -180,6 +191,12 @@ Because there is no such image `sheris`. At least for now :)
180
191
To fix it, run `kubectl edit ohno` and modify the following line `- image: sheris` to `- image: redis` or any other image you prefer.
181
192
</b></details>
182
193
194
+
<details>
195
+
<summary>You try to run a Pod but it's in "Pending" state. What might be the reason?</summary><br><b>
196
+
197
+
One possible reason is that the scheduler which supposed to schedule Pods on nodes, is not running. To verify it, you can run `kubectl get po -A | grep scheduler` or check directly in `kube-system` namespace.
198
+
</b></details>
199
+
183
200
## Namespaces
184
201
185
202
<details>
@@ -194,6 +211,32 @@ To fix it, run `kubectl edit ohno` and modify the following line `- image: sheri
194
211
`k create ns alle`
195
212
</b></details>
196
213
214
+
<details>
215
+
<summary>Check how many namespaces are there</summary><br><b>
216
+
217
+
`k get ns --no-headers | wc -l`
218
+
</b></details>
219
+
220
+
<details>
221
+
<summary>Check how many pods exist in the "dev" namespace</summary><br><b>
222
+
223
+
`k get po -n dev`
224
+
</b></details>
225
+
226
+
<details>
227
+
<summary>Create a pod called "kartos" in the namespace dev. The pod should be using the "redis" image.</summary><br><b>
228
+
229
+
If the namespace doesn't exist already: `k create ns dev`
230
+
231
+
`k run kratos --image=redis -n dev`
232
+
</b></details>
233
+
234
+
<details>
235
+
<summary>You are looking for a Pod called "atreus". How to check in which namespace it runs?</summary><br><b>
236
+
237
+
`k get po -A | grep atreus`
238
+
</b></details>
239
+
197
240
## Nodes
198
241
199
242
<details>
@@ -212,10 +255,57 @@ Note: create an alias (`alias k=kubectl`) and get used to `k get no`
212
255
213
256
## Services
214
257
258
+
<details>
259
+
<summary>Check how many services are running in the current namespace</summary><br><b>
260
+
261
+
`k get svc`
262
+
</b></details>
263
+
215
264
<details>
216
265
<summary>Create an internal service called "sevi" to expose the app 'web' on port 1991</summary><br><b>
217
266
</b></details>
218
267
268
+
<details>
269
+
<summary>How to reference by name a service called "app-service" within the same namespace?</summary><br><b>
270
+
271
+
app-service
272
+
</b></details>
273
+
274
+
<details>
275
+
<summary>How to check the TargetPort of a service?</summary><br><b>
276
+
277
+
`k describe svc <SERVICE_NAME>`
278
+
</b></details>
279
+
280
+
<details>
281
+
<summary>How to check what endpoints the svc has?</summary><br><b>
282
+
283
+
`k describe svc <SERVICE_NAME>`
284
+
</b></details>
285
+
286
+
<details>
287
+
<summary>How to reference by name a service called "app-service" within a different namespace, called "dev"?</summary><br><b>
288
+
289
+
app-service.dev.svc.cluster.local
290
+
</b></details>
291
+
292
+
<details>
293
+
<summary>Assume you have a deployment running and you need to create a Service for exposing the pods. This is what is required/known:
0 commit comments