K8s给命名空间设置专享节点

是指在特定命名空间下部署的 Pod 都会被调度到指定标签的节点上,这个功能需要在 kube-apiserver 添加 PodNodeSelector 参数

1
2
3
4
5
6
7
8
9
10
11
apiVersion: v1
kind: Pod
metadata:
labels:
component: kube-apiserver
tier: control-plane
name: kube-apiserver
namespace: kube-system
...
- --enable-admission-plugins=NodeRestriction,PodNodeSelector
...

然后给命名空间添加 annotation

1
2
3
4
5
apiVersion: v1
kind: Namespace
metadata:
annotations:
scheduler.alpha.kubernetes.io/node-selector: test.io/app=true
Author

Warner Chen

Posted on

2024-03-30

Updated on

2024-03-31

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.