From ad670c36fff3ed00b1cd59c9a2db9f67bb159c86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 9 Jul 2023 07:26:28 +0200 Subject: [PATCH] ns,jobs --- rtfd/public/kubernetes/index.rst | 115 +++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/rtfd/public/kubernetes/index.rst b/rtfd/public/kubernetes/index.rst index 14c2765..e0a5727 100644 --- a/rtfd/public/kubernetes/index.rst +++ b/rtfd/public/kubernetes/index.rst @@ -2,6 +2,9 @@ Kubernetes ********** +* Deployment → ReplicaSet → Pods → Containers +* 1 IP address per pod + Pods ==== @@ -164,3 +167,115 @@ Write .. warning:: ClusterIP is immutable! + +NameSpaces +========== + +Special: +* default +* kube-node-lease +* kube-public +* kube-system + +Outside: +* Nodes +* Pod Security Policies +* Persistent Volumes + +.. code:: shell + + kubectl api-resources \ + --namespaced false + +Read +---- + +.. code:: shell + + kubectl \ + get namespaces + +Write +----- + +.. code:: shell + + kubectl \ + create ns my-namespace + +.. code:: shell + + kubectl \ + delete ns my-namespace + +Jobs +==== + +* one-time +* sequential +* parallel + +CronJob → Job → Pods + +Read +---- + +.. code:: shell + + kubectl \ + get jobs \ + -n my-namespace + +Write +----- + +.. code:: shell + + kubectl \ + create job my-job \ + --image my-image \ + -n my-namespace + +.. code:: shell + + kubectl \ + create job my-job \ + --from cronjob/my-cronjob \ + -n my-namespace + +.. code:: shell + + kubectl \ + apply -f file.yaml \ + -n my-namespace + +.. code:: yaml + + apiVersion: batch/v1 + kind: Job + metadata: + name: my-job + spec: + activeDeadlineSeconds: 60 + backoffLimit: 4 + completions: 1 + parallelism: 1 + template: + spec: + containers: + - name: my-container + image: my-image + restartPolicy: OnFailure + +.. code:: shell + + kubectl \ + delete job my-job \ + -n my-namespace + +.. code:: shell + + kubectl \ + delete job my-job \ + cascade=false \ + -n my-namespace