如何在运行apiserver的主节点上部署pod



我有一个pod,它本质上是一个apiserver的插件,它几乎不是工作负载pod,它的任务是将手表外部化到另一个pubsub设施(就像从一个api到另一个子api的桥梁(为了减少延迟和实际网络连接的数量,我认为始终将其1副本部署部署到运行apiserver本身的同一台机器上可能是有意义的。原来它是一个主节点。Pod几乎不需要ram和CPU,纯流式Pod没有任何端点——从k8s手表到其他东西的桥梁。我该怎么做?

如果您的意图只是在主节点上运行特定的pod,而而不是打开主节点,那么您应该实现tolerationsnodeSelector。下面的示例将始终在主节点上运行busybox:

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

如果您想在主节点上部署pod
刚运行:

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

最新更新