I have a pod that is essentially a plugin for an apiserver, it's almost no workload pod which task is to externalize watches to another pubsub facility (serves like a bridge from one api to another) To reduce the latency and amount of real network connections I thought that it may make sense to always deploy its 1-replica deployment to same machine, that is running apiserver itself. It turns out that it's a master node. Pod almost does not take ram and CPU, pure streaming pod without any endpoints - bridge from k8s watches to something other. How can I do that?
Asked
Active
Viewed 479 times
0
-
1"Taint and tolerance" in official documents are good place to start. – P.... Dec 14 '21 at 02:02
2 Answers
3
If your intention is only to run a specific pod on the master node and not open up the master node, you should implement tolerations
and nodeSelector
. The sample below will always run busybox on the master node:
apiVersion: v1
kind: Pod
metadata:
name: busybox
labels:
run: busybox
spec:
restartPolicy: Never
nodeSelector:
<a unique label on your master node>: <the label value>
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: busybox
image: busybox
imagePullPolicy: IfNotPresent
command: ["ash","-c","sleep 3600"]

gohm'c
- 13,492
- 1
- 9
- 16
1
If you want deploy a pod on master node.
Just run:
kubectl taint nodes --all node-role.kubernetes.io/master-

quoc9x
- 1,423
- 2
- 9
- 26
-
Is it guaranteed to be deployed on same node that runs apiserver pod? – xakepp35 Dec 14 '21 at 02:10
-
The command above only allows running pod on master node. You need to specify the pod running on it too. – quoc9x Dec 14 '21 at 03:21