Kubernetes: Nodes, scheduling & access control
11 Kubernetes commands: Nodes, scheduling & access control. Click a command to see what each part does.
Kubernetes: Nodes, scheduling & access controlIndex
- Whole sheet137
- Basics: cluster, namespaces & resources17
- Get & list resources23
- Context & namespace3
- Find resources9
- Debug: describe, events, logs8
- Exec, port-forward, copy4
- Deploy, roll out, roll back, scale7
- Cleanup & nodes4
- Services, DNS & networking checks6
- Environment, config & secrets of workloads9
- Create, generate & apply YAML10
- Patch, label, annotate & scale9
- Delete & force delete6
- Nodes, scheduling & access control11
- Productivity: aliases, contexts & output11
Nodes, scheduling & access control11
kubectl cordon <node>Stop new pods landing on a nodeWhat each part does
cordonmark unschedulable; running pods stay (drain to evict them, uncordon to undo)
kubectl taint nodes <node> <key>=<value>:NoSchedule; kubectl taint nodes <node> <key>:NoSchedule-Taint a node / remove a taintWhat each part does
<key>=<value>:NoScheduleonly pods tolerating this taint can schedule here (NoExecute also evicts)<key>:NoSchedule-trailing minus removes it
kubectl label node <node> <key>=<value>Label a nodeWhat each part does
label nodeused by nodeSelector / affinity, e.g. disktype=ssd
kubectl get nodes --show-labels; kubectl describe node <node> | grep -A3 TaintsNode labels and taintsWhat each part does
--show-labelsall labels (zone, instance type, OS, arch)grep -A3 Taintstaints on the node
kubectl describe node <node> | grep -A8 'Allocated resources'How full is a node? (requests vs capacity)What each part does
Allocated resourcessum of CPU/memory requests and limits vs allocatable: why pods are Pending even if usage is low
kubectl auth can-i <verb> <resource> -n <namespace> --as=<user-or-sa>Can I (or someone) do this?What each part does
auth can-iyes/no for an action, e.g. can-i delete pods--as=<user-or-sa>impersonate, e.g. system:serviceaccount:<ns>:<sa>
kubectl auth can-i --list -n <namespace>Everything I am allowed to doWhat each part does
--listall verbs per resource for the current user in that namespace
kubectl auth whoamiWho am I logged in as?What each part does
auth whoamiuser name and groups the API server sees for your credentials
kubectl create token <serviceaccount> -n <namespace> --duration=1hCreate a short-lived token for a service accountWhat each part does
create tokenrequest a bound token (no long-lived secret)--duration=1hlifetime
kubectl get csr; kubectl certificate approve <csr>Approve a certificate signing requestCautionWhat each part does
get csrpending node / user certificate requestscertificate approvesign it
kubectl versionClient and server versionsWhat each part does
kubectl versionclient and API server versions; keep kubectl within one minor version of the server
Nothing matches.
My DevOps Playbook by Angelo John Calleja