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