简体   繁体   中英

How to deploy a pod on a master node running apiserver

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?

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM