From f5e7a486435bdad8a74aa5bf117b6b6233955e01 Mon Sep 17 00:00:00 2001 From: Melony QIN Date: Mon, 12 Aug 2019 19:36:04 +0100 Subject: [PATCH 1/2] add kubectl run deploy pod into specific namespace --- content/en/docs/reference/kubectl/cheatsheet.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index ea846c4254f2c..626da64f57b89 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -290,6 +290,10 @@ kubectl logs -f my-pod # stream pod logs (stdout) kubectl logs -f my-pod -c my-container # stream pod container logs (stdout, multi-container case) kubectl logs -f -l name=myLabel --all-containers # stream all pods logs with label name=myLabel (stdout) kubectl run -i --tty busybox --image=busybox -- sh # Run pod as interactive shell +kubectl run nginx --image=nginx --restart=Never -n # Run pod nginx in a specific namespace +kubectl run nginx --image=nginx --restart=Never # Run pod nginx and write its spec into a file called pod.yaml +--dry-run -o yaml > pod.yaml +mynamespace kubectl attach my-pod -i # Attach to Running Container kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod kubectl exec my-pod -- ls / # Run command in existing pod (1 container case) From 1511ef34332e9fc845f9a34ef9093fdf80e3dced Mon Sep 17 00:00:00 2001 From: Melony QIN Date: Tue, 13 Aug 2019 08:43:41 +0100 Subject: [PATCH 2/2] add my namespace --- content/en/docs/reference/kubectl/cheatsheet.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 626da64f57b89..314147f6e158d 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -290,10 +290,11 @@ kubectl logs -f my-pod # stream pod logs (stdout) kubectl logs -f my-pod -c my-container # stream pod container logs (stdout, multi-container case) kubectl logs -f -l name=myLabel --all-containers # stream all pods logs with label name=myLabel (stdout) kubectl run -i --tty busybox --image=busybox -- sh # Run pod as interactive shell -kubectl run nginx --image=nginx --restart=Never -n # Run pod nginx in a specific namespace +kubectl run nginx --image=nginx --restart=Never -n +mynamespace # Run pod nginx in a specific namespace kubectl run nginx --image=nginx --restart=Never # Run pod nginx and write its spec into a file called pod.yaml --dry-run -o yaml > pod.yaml -mynamespace + kubectl attach my-pod -i # Attach to Running Container kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod kubectl exec my-pod -- ls / # Run command in existing pod (1 container case)