summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-01-04 16:44:29 -0500
committerLouie S <louie@example.com>2024-01-04 16:44:29 -0500
commit74dc4b1a42ac32c3d63cd7d4a05ef659c1b71131 (patch)
treef1a85840929ddade695b871fd7e46d77b7862c86
parenteb2501259115554ade0febef189bb74ab9fbecd7 (diff)
Watched through ch. 14
-rw-r--r--kubernetes_cheat_sheet.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/kubernetes_cheat_sheet.md b/kubernetes_cheat_sheet.md
index 00103bc..3af0af6 100644
--- a/kubernetes_cheat_sheet.md
+++ b/kubernetes_cheat_sheet.md
@@ -40,8 +40,10 @@
|`kubectl describe pod [podname]` |Show pod info |
|`kubectl get pod [podname] -o yaml > file.yaml`|Extract the pod definition in YAML and save it to a file|
|`kubectl exec -it [podname] -- sh` |Interactive mode |
+|`kubectl exec -it [podname] -c [containername] -- sh`|Exec into a pod|
|`kubectl delete -f [pod-definition.yml]`|Delete a pod |
|`kubectl delete pod [podname]` |Same using the pod's name |
+|`kubectl logs [podname] -c [containername]`|Get the logs for a container|
### Misc.
@@ -223,3 +225,32 @@ spec:
image: busybox:1.28
command: ['sh', '-c', "until lookup mydb.namespace.svc.cluster.local; do echo waiting for mydb; sleep 2; done"]
```
+
+---
+
+### Multi-Containers Pods
+
+Example of defining multiple containers in a single pod definition
+
+```yaml
+apiVersion: v1
+kind: Pod
+metadata:
+ name: two-containers
+spec:
+ restartPolicy: Always
+ containers:
+ # Container #1
+ - name: mynginx
+ image: nginx
+ ports:
+ - containerPort: 80
+ # Container #2
+ - name: mybox
+ image: busybox
+ ports:
+ - containerPort: 81
+ command:
+ - sleep
+ - "3600"
+```