我为kube-apiserver有一个配置文件。
KUBE_APISERVER_OPTS="
--logtostderr=true
--v=4
--etcd-servers=https://172.16.0.2:2379,https://172.16.0.3:2379
--bind-address=172.16.0.2
--secure-port=6443
--advertise-address=172.16.0.2
--allow-privileged=true
--service-cluster-ip-range=10.0.0.0/24
--enable-admission-plugins=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota,NodeRestriction
--authorization-mode=RBAC,Node --enable-bootstrap-token-auth
--token-auth-file=/k8s/kubernetes/cfg/token.csv
--service-node-port-range=30000-50000
--tls-cert-file=/k8s/kubernetes/ssl/server.pem
--tls-private-key-file=/k8s/kubernetes/ssl/server-key.pem
--client-ca-file=/k8s/kubernetes/ssl/ca.pem
--service-account-key-file=/k8s/kubernetes/ssl/ca-key.pem
--etcd-cafile=/k8s/etcd/ssl/ca.pem --etcd-certfile=/k8s/etcd/ssl/server.pem
--etcd-keyfile=/k8s/etcd/ssl/server-key.pem"
然后我像这样添加系统单元:
[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/kubernetes/kubernetes
[Service]
EnvironmentFile=-/k8s/kubernetes/cfg/kube-apiserver
ExecStart=/k8s/kubernetes/bin/kube-apiserver $KUBE_APISERVER_OPTS
Restart=on-failure
[Install]
WantedBy=multi-user.target
但是当我启动kube-apiserver时,它会显示配置错误提示:
error: invalid authentication config: parse error on line 1, column 82: extraneous or missing " in quoted-field
您能告诉我我的错误在哪里,谢谢! error hints
答案 0 :(得分:1)
systemd
环境文件的格式必须正确,如果要执行多行值,则包括转义行尾:
APISERVER=" \
--arg-1=2 \
--arg-2=3 \
--arg-3=4 \
"