From 3b6412da63fc57cab275de9efd21a3e1a0ebb338 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 10 Jul 2023 18:39:36 +0000 Subject: [PATCH] kube/ctl,ctx,ns --- rtfd/public/kubernetes/index.rst | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/rtfd/public/kubernetes/index.rst b/rtfd/public/kubernetes/index.rst index 0f74652..a35138e 100644 --- a/rtfd/public/kubernetes/index.rst +++ b/rtfd/public/kubernetes/index.rst @@ -618,3 +618,47 @@ Commands matchExpressions: - {key: version, operator: In, values: ["1.0","1.1","1.2"]} +kubectl +======= + +* kubectl version = api-server version ± 0.1 + +.. code:: shell + + kubectl \ + get namespace \ + -o 'custom-columns="NAME":".metadata.name"' \ + --no-headers + +.. code:: shell + + kubectl \ + -n my-namespace \ + get pod \ + --sort-by '.status.phase' + +.. code:: shell + + kubectl \ + -n my-namespace \ + get pod \ + --watch + +.. code:: shell + + kubectl \ + -n my-namespace \ + exec my-pod \ + -it -- \ + ls + +.. code:: shell + + kubectl config use-context my-cluster + kubectx my-cluster + +.. code:: shell + + kubectl config set-context --current --namespace my-namespace + kubens my-namespace +