kubectl get nodekubectl cordon $NODENAMEapiVersion: v1
kind: Pod
metadata:
name: resource-reserver
spec:
containers:
- name: sleep-forever
image: gcr.io/google_containers/pause:0.8.0
resources:
requests:
cpu: 100m
memory: 100MiSet the cpu and memory values to the amount of resources you want to reserve. Place the file in the manifest directory (--config=DIR flag of kubelet).
Pods can be filtered by their label with (in)equality (=|==, !=), by presence/abscence of value in set (in, notin) or by presence/abscence of the key. This filters can be aggregate by separing all filter with a comma, acting like an AND logical operator.
e.g.
kubectl get pods -l 'environment in (production, qa),tier=backend,partition'will process the folowing filter
["production", "qa"].includes(pod_labels.environment) && pod_labels.tier=="backend" && pod_labels.hasOwnProperty("partition")| Usage | Controllers |
|---|---|
| Oneshot pods, batch computations | Job |
| Web service, listenner | Deployments |
| Machine-specific service, one pod per machine | DaemonSet |