From 66773e27101bf03f771097e31cda0620d93e131f Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 19 Apr 2022 14:02:18 +0200 Subject: [PATCH] Added commands and sources --- knowledge base/kubectl.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/knowledge base/kubectl.md b/knowledge base/kubectl.md index ec306c2..4187a2d 100644 --- a/knowledge base/kubectl.md +++ b/knowledge base/kubectl.md @@ -3,9 +3,36 @@ ## TL;DR ```shell +# list resources +kubectl get pods +kubectl get pods -n kube-system coredns-845757d86-47np2 +kubectl get namespaces --show-labels +kubectl get services -o wide + +# start a pod +kubectl run nginx --image nginx + +# taint a node +kubectl taint nodes node1 key1=value1:NoSchedule + # taint all nodes in a certain nodepool (azure aks) kubectl get nodes \ -l "agentpool=nodepool1" \ -o jsonpath='{.items[*].metadata.name}' | xargs -n1 -I{} -p kubectl taint nodes {} key1=value1:NoSchedule + +# remove a taint +# notice the '-' sign at the end +kubectl taint nodes node1 key1=value1:NoSchedule- ``` + +## Further readings + +- [Assigning Pods to Nodes] +- [Taints and Tolerations] +- [Commands reference] + +[assigning pods to nodes]: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/ +[taints and tolerations]: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ + +[commands reference]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands