From 62b279afbbeeabd95695bea4e3234b2c6733ea8f Mon Sep 17 00:00:00 2001 From: Melony QIN Date: Fri, 27 Sep 2019 22:04:42 +0100 Subject: [PATCH] add kubectl run deploy pod into specific namespace (#15825) * add kubectl run deploy pod into specific namespace * add my namespace --- content/en/docs/reference/kubectl/cheatsheet.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 9920ff1c35..55030981df 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -290,6 +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 +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 + 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)