From e160156e8b52ddcc2971a754d5388255fab7ad8d Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sat, 22 Apr 2023 21:02:00 +0200 Subject: [PATCH] chore: moved articles to the specific subsection --- ...eck a pod can connect to an external db.md | 22 +++++++++++++++ .../drain a node.md} | 25 ++++++++++++++--- ...ent of a process running in a container.md | 16 +++++++++++ knowledge base/kubernetes/kubectl.md | 13 +++++++-- knowledge base/{ => kubernetes}/minikube.md | 27 +++++++++++++++++-- 5 files changed, 96 insertions(+), 7 deletions(-) rename knowledge base/{ => kubernetes}/check a pod can connect to an external db.md (51%) rename knowledge base/{drain a k8s cluster node.md => kubernetes/drain a node.md} (57%) rename knowledge base/{ => kubernetes}/get the environment of a process running in a container.md (54%) rename knowledge base/{ => kubernetes}/minikube.md (79%) diff --git a/knowledge base/check a pod can connect to an external db.md b/knowledge base/kubernetes/check a pod can connect to an external db.md similarity index 51% rename from knowledge base/check a pod can connect to an external db.md rename to knowledge base/kubernetes/check a pod can connect to an external db.md index 0e0f5a7..2108721 100644 --- a/knowledge base/check a pod can connect to an external db.md +++ b/knowledge base/kubernetes/check a pod can connect to an external db.md @@ -1,5 +1,11 @@ # Check a Pod can connect to an external DB +## Table of contents + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) +1. [Sources](#sources) + ## TL;DR ```sh @@ -15,3 +21,19 @@ nc -vz -w3 10.0.2.15 3306 # test the client can connect mysql --host 10.0.2.15 --port 3306 --user root ``` + +## Further readings + +- [Kubernetes] +- [`kubectl`][kubectl] + +## Sources + +All the references in the [further readings] section, plus the following: + + +[further readings]: #further-readings +[kubectl]: kubectl.md +[kubernetes]: README.md + + diff --git a/knowledge base/drain a k8s cluster node.md b/knowledge base/kubernetes/drain a node.md similarity index 57% rename from knowledge base/drain a k8s cluster node.md rename to knowledge base/kubernetes/drain a node.md index f75b5ca..ce60ee4 100644 --- a/knowledge base/drain a k8s cluster node.md +++ b/knowledge base/kubernetes/drain a node.md @@ -1,16 +1,24 @@ # Drain a K8S cluster node +## Table of contents + +1. [TL:DR](#tldr) +1. [Further readings](#further-readings) +1. [Sources](#sources) + +## TL:DR + 1. mark the node as unschedulable (_cordon_): ```sh - $ kubectl cordon kworker-rj2 + $ kubectl cordon 'kworker-rj2' node/kworker-rj2 cordoned ``` 1. remove pods running on the node: ```sh - $ kubectl drain kworker-rj2 --grace-period=300 --ignore-daemonsets=true + $ kubectl drain 'kworker-rj2' --grace-period=300 --ignore-daemonsets=true node/kworker-rj2 already cordoned WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-fl8dl, kube-system/kube-proxy-95vdf evicting pod default/my-dep-557548758d-d2pmd @@ -22,12 +30,23 @@ 1. make the node available again: ```sh - $ kubectl uncordon kworker-rj2 + $ kubectl uncordon 'kworker-rj2' node/kworker-rj2 uncordoned ``` +## Further readings + +- [Kubernetes] +- [`kubectl`][kubectl] + ## Sources +All the references in the [further readings] section, plus the following: + - [How to drain a node in Kubernetes] + +[further readings]: #further-readings + + [how to drain a node in kubernetes]: https://linuxhandbook.com/kubectl-drain-node/ diff --git a/knowledge base/get the environment of a process running in a container.md b/knowledge base/kubernetes/get the environment of a process running in a container.md similarity index 54% rename from knowledge base/get the environment of a process running in a container.md rename to knowledge base/kubernetes/get the environment of a process running in a container.md index 610378b..b4f42ae 100644 --- a/knowledge base/get the environment of a process running in a container.md +++ b/knowledge base/kubernetes/get the environment of a process running in a container.md @@ -1,5 +1,11 @@ # Get the environment of a process running in a container +## Table of contents + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) +1. [Sources](#sources) + ## TL;DR ```sh @@ -11,9 +17,19 @@ kubectl exec pod-name -- cat /proc/1/environ # Only works if the onboard `ps` is not from busybox. ps e -p $PID ``` +## Further readings + +- [Kubernetes] +- [`kubectl`][kubectl] ## Sources +All the references in the [further readings] section, plus the following: + - [Get the environment variables of running process in container] + +[further readings]: #further-readings + + [get the environment variables of running process in container]: https://unix.stackexchange.com/a/412730 diff --git a/knowledge base/kubernetes/kubectl.md b/knowledge base/kubernetes/kubectl.md index 9ef8adc..9eaa80e 100644 --- a/knowledge base/kubernetes/kubectl.md +++ b/knowledge base/kubernetes/kubectl.md @@ -21,7 +21,9 @@ kubectl get pod etcd-minikube -n kube-system kubectl get pods -l app=nginx,tier=frontend ``` -### Table of contents +One possible output format is [JSONpath]. + +## Table of contents 1. [TL;DR](#tldr) 1. [Configuration](#configuration) @@ -563,6 +565,7 @@ Verbosity | Description ## Further readings +- [Kubernetes] - [Assigning Pods to Nodes] - [Taints and Tolerations] - [Commands reference] @@ -572,6 +575,8 @@ Verbosity | Description ## Sources +All the references in the [further readings] section, plus the following: + - [Cheatsheet] - [Run a single-instance stateful application] - [Run a replicated stateful application] @@ -586,7 +591,11 @@ Verbosity | Description [enforce pod security standards with namespace labels]: https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/ [taints and tolerations]: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ - + +[jsonpath]: ../jsonpath.md +[kubernetes]: README.md + + [accessing an application on kubernetes in docker]: https://medium.com/@lizrice/accessing-an-application-on-kubernetes-in-docker-1054d46b64b1 [run a replicated stateful application]: https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/ [run a single-instance stateful application]: https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/ diff --git a/knowledge base/minikube.md b/knowledge base/kubernetes/minikube.md similarity index 79% rename from knowledge base/minikube.md rename to knowledge base/kubernetes/minikube.md index b655fe6..3aace3e 100644 --- a/knowledge base/minikube.md +++ b/knowledge base/kubernetes/minikube.md @@ -1,5 +1,14 @@ # Minikube +## Table of contents + +1. [TL;DR](#tldr) +1. [Troubleshooting](#troubleshooting) + 1. [What happens if I use the _LoadBalancer_ type with Services?](#what-happens-if-i-use-the-loadbalancer-type-with-services) + 1. [Can I use custom certificates?](#can-i-use-custom-certificates) +1. [Further readings](#further-readings) +1. [Sources](#sources) + ## TL;DR ```sh @@ -67,10 +76,15 @@ Minikibe's certificates are available in the `~/.minikube/certs` folder. ## Further readings +- [Website] - [Drivers] +- [Kubernetes] +- [`kubectl`][kubectl] ## Sources +All the references in the [further readings] section, plus the following: + - [Accessing] the services - [Getting started] guide - Cluster [configuration] @@ -81,13 +95,22 @@ Minikibe's certificates are available in the `~/.minikube/certs` folder. - How to [use local docker images] in Minikube - How to [use untrusted certs] + [accessing]: https://minikube.sigs.k8s.io/docs/handbook/accessing [completion]: https://minikube.sigs.k8s.io/docs/commands/completion [configuration]: https://minikube.sigs.k8s.io/docs/handbook/config [docker driver]: https://minikube.sigs.k8s.io/docs/drivers/docker [drivers]: https://minikube.sigs.k8s.io/docs/drivers [getting started]: https://minikube.sigs.k8s.io/docs/start -[hello world]: https://kubernetes.io/docs/tutorials/hello-minikube [ssh]: https://minikube.sigs.k8s.io/docs/commands/ssh -[use local docker images]: https://stackoverflow.com/questions/42564058/how-to-use-local-docker-images-with-minikube#62303945 [use untrusted certs]: https://minikube.sigs.k8s.io/docs/handbook/untrusted_certs +[website]: https://minikube.sigs.k8s.io + + +[further readings]: #further-readings +[kubectl]: kubectl.md +[kubernetes]: README.md + + +[hello world]: https://kubernetes.io/docs/tutorials/hello-minikube +[use local docker images]: https://stackoverflow.com/questions/42564058/how-to-use-local-docker-images-with-minikube#62303945