I have one config file for 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"
Then I add system unit like this:
[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
But when I startup kube-apiserver, it shows me the hints with config error:
error: invalid authentication config: parse error on line 1, column 82: extraneous or missing " in quoted-field
Could you tell me where is my error, thanks much! error hints
systemd
environment files must be formatted correctly, which includes escaping the end of your lines if you wish to do multi line values:
APISERVER=" \
--arg-1=2 \
--arg-2=3 \
--arg-3=4 \
"