k8s 安装启动碰到的问题
安装过程:https://www.jianshu.com/p/65ecef9016aekube-apiserver启动失败kube-apiserver.service - Kubernetes API ServerLoaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disab
·
安装过程:https://www.jianshu.com/p/65ecef9016ae
kube-apiserver启动失败
kube-apiserver.service - Kubernetes API Server
Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since 一 2021-05-10 16:50:29 CST; 1s ago
Docs: https://github.com/GoogleCloudPlatform/kubernetes
Process: 10697 ExecStart=/usr/bin/kube-apiserver $KUBE_LOGTOSTDERR $KUBE_LOG_LEVEL $KUBE_ETCD_SERVERS $KUBE_API_ADDRESS $KUBE_API_PORT $KUBELET_PORT $KUBE_ALLOW_PRIV $KUBE_SERVICE_ADDRESSES $KUBE_ADMISSION_CONTROL $KUBE_API_ARGS (code=exited, status=255)
Main PID: 10697 (code=exited, status=255)
5月 10 16:50:29 k8s-master systemd[1]: Unit kube-apiserver.service entered....
5月 10 16:50:29 k8s-master systemd[1]: kube-apiserver.service failed.
5月 10 16:50:29 k8s-master systemd[1]: kube-apiserver.service holdoff time....
5月 10 16:50:29 k8s-master systemd[1]: Stopped Kubernetes API Server.
5月 10 16:50:29 k8s-master systemd[1]: start request repeated too quickly ...e
5月 10 16:50:29 k8s-master systemd[1]: Failed to start Kubernetes API Server.
5月 10 16:50:29 k8s-master systemd[1]: Unit kube-apiserver.service entered....
5月 10 16:50:29 k8s-master systemd[1]: kube-apiserver.service failed.
可能是配置文件中KUBE_ADMISSION_CONTROL的错
- 查看apiserver的配置文件vi /etc/kubernetes/apiserver
其中KUBE_ADMISSION_CONTROL需要删除ServiceAccount
##
# kubernetes system config
#
# The following values are used to configure the kube-apiserver
#
# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
# The port on the local server to listen on.
KUBE_API_PORT="--port=8080"
# Port minions listen on
# KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://etcd:2379"
# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# default admission control policies
#KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"
# Add your own!
KUBE_API_ARGS=""
但是改完后依旧报错,就需要看看etcd是否启动成功
etcd
etcd启动失败
修改两个配置文件:/etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.58.130:2380"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_NAME="master"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://etcd:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://etcd:2379"
ETCD_INITIAL_CLUSTER="master=http://192.168.58.130:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
需要修改/usr/lib/systemd/system/etcd.service配置,关键就在ExecStart
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
EnvironmentFile=/etc/etcd/etcd.conf
User=etcd
# set GOMAXPROCS to number of processors
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd \
--name=\"${ETCD_NAME}\" \
--data-dir=\"${ETCD_DATA_DIR}\" \
--listen-peer-urls=\"${ETCD_LISTEN_PEER_URLS}\" \
--advertise-client-urls=\"${ETCD_ADVERTISE_CLIENT_URLS}\" \
--initial-cluster-token=\"${ETCD_INITIAL_CLUSTER_TOKEN}\" \
--initial-cluster=\"${ETCD_INITIAL_CLUSTER}\" \
--initial-cluster-state=\"${ETCD_INITIAL_CLUSTER_STATE}\" \
--listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\""
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
然后etcd就启动成功了
再启动apiserver
最后
确定启动成功
更多推荐
已为社区贡献1条内容
所有评论(0)