由于您的X 问题是“如何修改调度程序配置”,您可以尝试以下方法。
使用 kubeadm
如果您kubeadm
用于引导集群,则可以--config
在运行时使用标志kubeadm init
来传递类型的自定义配置对象,ClusterConfiguration
以将额外的参数传递给控制平面组件。
调度程序的示例配置:
$ cat sched.conf
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: v1.16.0
scheduler:
extraArgs:
address: 0.0.0.0
config: /home/johndoe/schedconfig.yaml
kubeconfig: /home/johndoe/kubeconfig.yaml
$ kubeadm init --config sched.conf
您还可以尝试kubeadm upgrade apply --config sched.conf <k8s version>
在实时集群上应用更新的配置。
参考:https ://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/
您还可以编辑/etc/kubernetes/manifests/kube-scheduler.yaml
、修改标志以传递配置。volumes
确保通过 update和volumeMounts
section将文件挂载到 pod 中。
spec:
containers:
- command:
- kube-scheduler
- --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
- --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
- --bind-address=127.0.0.1
- --kubeconfig=/etc/kubernetes/scheduler.conf
- --leader-elect=true
- --config=/etc/kubernetes/mycustomconfig.conf
volumeMounts:
- mountPath: /etc/kubernetes/scheduler.conf
name: kubeconfig
readOnly: true
- mountPath: /etc/kubernetes/mycustomconfig.conf
name: customconfig
readOnly: true
volumes:
- hostPath:
path: /etc/kubernetes/scheduler.conf
type: FileOrCreate
name: kubeconfig
- hostPath:
path: /etc/kubernetes/mycustomconfig.conf
type: FileOrCreate
name: customconfig