我正在通过mumshad(https://github.com/mmumshad/kubernetes-the-hard-way/blob/master/docs/08-bootstrapping-kubernetes-controllers.md)艰难地安装kubernetes。目前停留在Bootstrapping Kubernetes Control Plane阶段,已经仔细遵循了文档中的说明,但是由于某种原因,kube-apiserver没有运行,并且处于自动重启状态。你们中的任何一个可以帮助我吗?两个主节点上都存在相同的问题,但是kube-schedular和kube-control管理器运行正常。下面提供了错误。
root@master-1:~# service kube-apiserver status.
● kube-apiserver.service - Kubernetes API Server
Loaded: loaded (/etc/systemd/system/kube-apiserver.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-02-22 09:28:07 UTC; 476ms ago
Docs: https://github.com/kubernetes/kubernetes
Process: 10656 ExecStart=/usr/local/bin/kube-apiserver --advertise-address=192.168.5.11 --allow-privileged=true --apiserver-count=3 --audit-log-maxage=30 --audit-log-maxbackup=3 --audi
Main PID: 10656 (code=exited, status=1/FAILURE)Feb 22 09:28:07 master-1 kube-apiserver[10656]: --log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximu
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --logtostderr log to standard error instead of files (default true)
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --skip-headers If true, avoid header prefixes in the log messages
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --skip-log-headers If true, avoid headers when opening log files
Feb 22 09:28:07 master-1 systemd[1]: kube-apiserver.service: Failed with result 'exit-code'.
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --stderrthreshold severity logs at or above this threshold go to stderr (default 2)
Feb 22 09:28:07 master-1 kube-apiserver[10656]: -v, --v Level number for the log level verbosity (default 0)
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --version version[=true] Print version information and quit
Feb 22 09:28:07 master-1 kube-apiserver[10656]: --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered loggingroot@master-1:~# kubectl get componentstatuses --kubeconfig admin.kubeconfig
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?
root@master-1:~#apiserver_service file:
cat <<EOF | sudo tee /etc/systemd/system/kube-apiserver.service
[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/kubernetes/kubernetes[Service]
ExecStart=/usr/local/bin/kube-apiserver \\
--advertise-address=${INTERNAL_IP} \\
--allow-privileged=true \\
--apiserver-count=3 \\
--audit-log-maxage=30 \\
--audit-log-maxbackup=3 \\
--audit-log-maxsize=100 \\
--audit-log-path=/var/log/audit.log \\
--authorization-mode=Node,RBAC \\
--bind-address=0.0.0.0 \\
--client-ca-file=/var/lib/kubernetes/ca.crt \\
--enable-admission-plugins=NodeRestriction,ServiceAccount \\
--enable-swagger-ui=true \\
--enable-bootstrap-token-auth=true \\
--etcd-cafile=/var/lib/kubernetes/ca.crt \\
--etcd-certfile=/var/lib/kubernetes/etcd-server.crt \\
--etcd-keyfile=/var/lib/kubernetes/etcd-server.key \\
--etcd-servers=https://192.168.5.11:2379,https://192.168.5.12:2379 \\
--event-ttl=1h \\
--encryption-provider-config=/var/lib/kubernetes/encryption-config.yaml \\
--kubelet-certificate-authority=/var/lib/kubernetes/ca.crt \\
--kubelet-client-certificate=/var/lib/kubernetes/kube-apiserver.crt \\
--kubelet-client-key=/var/lib/kubernetes/kube-apiserver.key \\
--kubelet-https=true \\
--runtime-config=api/all \\
--service-account-key-file=/var/lib/kubernetes/service-account.crt \\
--service-cluster-ip-range=10.96.0.0/24 \\
--service-node-port-range=30000-32767 \\
--tls-cert-file=/var/lib/kubernetes/kube-apiserver.crt \\
--tls-private-key-file=/var/lib/kubernetes/kube-apiserver.key \\
--v=2
Restart=on-failure
RestartSec=5[Install]
WantedBy=multi-user.target
EOF
答案 0 :(得分:3)
我已经解决了这个问题。问题出在参数 expo-detox-hook is not installed in your osx Library. Run `npm install -g expo-detox-cli && expotox clean-framework-cache && expotox build-framework-cache` to fix this.
上,它没有设置为任何值(true / false)。
错误:
--runtime-config=api/all
一旦将其设置为true(-runtime-config = api / all)并重新启动了服务,我便能够使kube-apiserver运行。
结果:
Feb 25 05:49:40 master-1 kube-apiserver[1228]: I0225 05:49:40.192274 1228 server.go:639] Initializing cache sizes based on 0MB limit
Feb 25 05:49:40 master-1 kube-apiserver[1228]: I0225 05:49:40.192416 1228 server.go:150] Version: v1.17.0
Feb 25 05:49:40 master-1 kube-apiserver[1228]: Error: invalid value api/all=
Feb 25 05:49:40 master-1 kube-apiserver[1228]: Usage:
Feb 25 05:49:40 master-1 kube-apiserver[1228]: kube-apiserver [flags]
答案 1 :(得分:0)
共享systemctl status kube-apiserver -l命令输出,还检查/ var / log / messages文件并在此处发布错误。
答案 2 :(得分:0)
我正在遵循 Kelsey Hightower 的教程来引导我的集群;开始面对这个错误。 ExecStart 命令在终端中运行时有效,但在 systemd 中失败;然后就知道了,我已经删除了单引号,并且像一个符咒一样工作。
## Earlier
--runtime-config='api/all=true'
## Correct
--runtime-config=api/all=true