I'm deploying my service under my namespace. We have a worker node farm and my service will only utilize a small subset of its nodes.
I want to deploy a DaemontSet of cAdvisors but I only want them to run in the nodes not related to my namespace. If possible, how to do that?
Thanks!
CodePudding user response:
DaemonSet runs one pod per node. You cant bypass a node.
CodePudding user response:
ScheduleDaemonSetPods
is a kubernetes feature that allows you to schedule DaemonSets using the default scheduler instead of the DaemonSet controller, by adding the NodeAffinity
term to the DaemonSet pods, instead of the .spec.nodeName
term. Kubernetes Document
For example below k8s manifest will create Pods on nodes with type=target-host-name
:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: testdaemon
spec:
template:
metadata:
labels:
app: testdaemon
annotations:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: type
operator: In
values:
- target-host-name
containers:
- name: testdaemon
image: nginx