Junior — Middle
How to deploy pods so that each worker node in the cluster runs one instance?
sobes.tech AI
Answer from AI
To deploy pods so that each worker node in the cluster runs a single instance, Kubernetes uses the DaemonSet object. DaemonSet ensures that one instance of a pod is running on each node.
Example of a DaemonSet manifest:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: example-daemonset
spec:
selector:
matchLabels:
name: example-pod
template:
metadata:
labels:
name: example-pod
spec:
containers:
- name: example-container
image: nginx
When such a DaemonSet is applied, Kubernetes will create one pod on each worker node of the cluster.