From cc09428797313a117fd30fb763551183054846ce Mon Sep 17 00:00:00 2001 From: AbdullahBM <36033293+AbdullahBM@users.noreply.github.com> Date: Tue, 9 Apr 2019 06:03:04 +0500 Subject: [PATCH] setting current context and finding running pod's YAML (#13665) --- 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 32a724d082..ad35375f77 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -69,6 +69,9 @@ kubectl config use-context my-cluster-name # set the default context t # add a new cluster to your kubeconf that supports basic auth kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword +# permanently save the namespace for all subsequent kubectl commands in that context. +kubectl config set-context --current --namespace=ggckad-s2 + # set a context utilizing a specific username and namespace. kubectl config set-context gce --user=cluster-admin --namespace=foo \ && kubectl config use-context gce @@ -142,6 +145,8 @@ kubectl get pods --all-namespaces # List all pods in all namespaces kubectl get pods -o wide # List all pods in the namespace, with more details kubectl get deployment my-dep # List a particular deployment kubectl get pods --include-uninitialized # List all pods in the namespace, including uninitialized ones +kubectl get pod my-pod -o yaml # Get a pod's YAML +kubectl get pod my-pod -o yaml --export # Get a pod's YAML without cluster specific information # Describe commands with verbose output kubectl describe nodes my-node