Home > Net >  How to deploy a pod on a master node running apiserver
How to deploy a pod on a master node running apiserver

Time:12-14

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?

CodePudding user response:

If you want deploy a pod on master node.
Just run:

kubectl taint nodes --all node-role.kubernetes.io/master-

CodePudding user response:

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"]
  • Related