Last active
August 15, 2025 09:34
-
-
Save DoZator/61f37d6b41c827ba9f73f55eef527d24 to your computer and use it in GitHub Desktop.
Revisions
-
DoZator revised this gist
Aug 15, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -102,7 +102,7 @@ kubectl logs {pod_name} --namespace {ns_name} * Stream logs of a pod (stdout) ```sh kubectl logs -f {pod_name} --namespace {ns_name} ``` * Access a running pod's shell -
DoZator revised this gist
Jul 31, 2025 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,3 +116,9 @@ kubectl exec -it {pod_name} -- bash ```sh kubectl exec -n {ns_name} {pod_name} -- env ``` * Delete pod ```sh kubectl -n {ns_name} delete pod {pod_name} ``` -
DoZator revised this gist
Apr 8, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -114,5 +114,5 @@ kubectl exec -it {pod_name} -- bash * Show pod's ENV ```sh kubectl exec -n {ns_name} {pod_name} -- env ``` -
DoZator created this gist
Apr 8, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,118 @@ ### Cluster & Context * List all available contexts ```sh kubectl config get-contexts ``` * Show current context ```sh kubectl config curret-context ``` * Switch to a different context ```sh kubectl config use-context {ctx_name} ``` * Set default namespace for a context ```sh kubectl config set-context {ctx_name} --namespace={ns_name} ``` * Show cluster info ```sh kubectl cluster-info ``` ### Namespaces * List all namespaces ```sh kubectl get namespaces ``` * Create namespace ```sh kubectl create namespace {ns_name} ``` * Delete namespace ```sh kubectl delete namespace {ns_name} ``` ### Pods * List pods across all namespaces ```sh kubectl get pods --all-namespaces ``` or ```sh kubectl get pods --A ``` * List pods in current namespace (default) ```sh kubectl get pods ``` * List pods for namespace ```sh kubectl get pods --namespace {ns_name} ``` * List pods for namespace with more details ```sh kubectl get pods --namespace {ns_name} -o wide ``` * Show details of a specific pod ```sh kubectl describe pod {pod_name} ``` * Show CPU and memory usage for pods in namespace ```sh kubectl top pod --namespace {ns_name} ``` * Fetch logs of a pod ```sh kubectl logs {pod_name} --namespace {ns_name} ``` * Stream logs of a pod (stdout) ```sh kubectl -f logs {pod_name} --namespace {ns_name} ``` * Access a running pod's shell ```sh kubectl exec -it {pod_name} -- bash ``` * Show pod's ENV ```sh kubectl exec -n {ns_name} liveness-845d996f9c-w6j95 -- env ```