Kubernetes 在gke中配置特征门时出错
我试图在节点版本为1.9.7的GKE节点上运行Kubernetes 在gke中配置特征门时出错,kubernetes,google-kubernetes-engine,Kubernetes,Google Kubernetes Engine,我试图在节点版本为1.9.7的GKE节点上运行kubelet参数add--feature gates=readonlyapitavolumes=false 然后我得到了以下错误: I1002 00:56:53.617596 13469 feature_gate.go:226] feature gates: &{{} map[ReadOnlyAPIDataVolumes:false]} I1002 00:56:53.617724 13469 controller.go:114] k
kubelet参数add--feature gates=readonlyapitavolumes=false
然后我得到了以下错误:
I1002 00:56:53.617596 13469 feature_gate.go:226] feature gates: &{{} map[ReadOnlyAPIDataVolumes:false]}
I1002 00:56:53.617724 13469 controller.go:114] kubelet config controller: starting controller
I1002 00:56:53.617729 13469 controller.go:118] kubelet config controller: validating combination of defaults and flags
error: error reading /var/lib/kubelet/pki/kubelet.key, certificate and key must be supplied as a pair
如果我运行sudo kubelet parameters add--feature gates=readonlyapitavolumes=false
,那么我得到
error: unrecognized key: ReadOnlyAPIDataVolumes
我的问题是:
- 通常,kubelet命令是否应该从根目录执行
- 具体如何成功运行“kubelet参数添加”命令
非根运行
,但kubelet可以控制系统上的许多不同组件,因此很难让它作为非根运行
kubelet参数add
从何而来,也不知道它是如何在GKE上设置的(我相信这是一个好的kube up.sh
脚本),但一般来说,您可以在systemd
级别更改kubelet参数。例如,根据以下systemd
服务定义,我在/var/lib/kubelet/kubeadm flags.env
中使用kubeadm和change/add标志,或者只在kubelet命令行内联使用:
$ systemctl cat kubelet
# /lib/systemd/system/kubelet.service
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/home/
[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap- kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --hostname-override=ip-x-x-x-x.us-east-1.compute.internal"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS