kubectl edit cm -n kube-system kubeadm-config
data:
ClusterConfiguration: |
apiServer:
extraArgs:
authorization-mode: Node,RBAC
# 增加配置,开启 enable-admission-plugins
enable-admission-plugins: NodeRestriction,PodNodeSelector,PodTolerationRestriction
...
...
apiServer:
timeoutForControlPlane: 4m0s
# 增加扩展配置
extraArgs:
authorization-mode: Node,RBAC
enable-admission-plugins: NodeRestriction,PodNodeSelector,PodTolerationRestriction
...
# kubeadm init phase control-plane <component-name> --config <config-file>
kubeadm init phase control-plane apiserver --config kubeadm-init.yaml
apiVersion: v1
kind: Namespace
metadata:
...
annotations:
...
# 默认的节点选择
scheduler.alpha.kubernetes.io/node-selector: 'node-role.kubernetes.io/whitetiger=true'
# 默认的污点容忍
scheduler.alpha.kubernetes.io/defaultTolerations: '[{"operator": "Exists", "effect": "NoSchedule", "key": "whitetiger"}]'
# 污点容忍列表白名单
scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{"effect":"NoExecute","key":"node.kubernetes.io/not-ready","operator":"Exists"},{"effect":"NoExecute","key":"node.kubernetes.io/unreachable","operator":"Exists"},{"effect":"NoSchedule","key":"node.kubernetes.io/memory-pressure","operator":"Exists"},{"effect":"NoSchedule","key":"whitetiger","operator":"Exists"}]'
...
https://kubernetes.io/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/