安装minikube中启动kubectl失败踩坑
安装minikube中启动kubectl失败环境:win10家庭版安装VMware,VMware中安装centos7及virtualbox6.0/etc/sysconfig/docker 的配置如下# /etc/sysconfig/docker# Modify these options if you want to change the way the docker daemon ru...
·
安装minikube中启动kubectl失败
环境:win10家庭版安装VMware,VMware中安装centos7及virtualbox6.0
/etc/sysconfig/docker 的配置如下
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
# OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi
# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.
# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp
# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false
# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines
#DOCKERBINARY=/usr/bin/docker-latest
#DOCKERDBINARY=/usr/bin/dockerd-latest
#DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest
#DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest
/usr/lib/systemd/system/docker.service配置如下
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
Requires=docker-cleanup.timer
[Service]
Type=notify
NotifyAccess=main
EnvironmentFile=-/run/containers/registries.conf
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=cgroupfs \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
--init-path=/usr/libexec/docker/docker-init-current \
--seccomp-profile=/etc/docker/seccomp.json \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
$REGISTRIES
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
KillMode=process
[Install]
WantedBy=multi-user.target
安装步骤来自于https://www.cnblogs.com/allenwas3/p/11528669.html
详细报错信息为
failed to run Kubelet: unable to load bootstrap kubeconfig: stat /etc/kubernetes/bootstrap-kubelet.conf: no such file or directory
报错原因:minikube版本和运行时指定的kubernetes版本信息不一致导致
修改:重新安装minikube
然后有报错了。。。。
Unable to start VM
❌ Error: [VBOX_KERNEL_MODULE_NOT_LOADED] create: precreate: We support Virtualbox starting with version 5. Your VirtualBox install is "WARNING: The vboxdrv kernel module is not loaded. Either there is no module\n available for the current kernel (3.10.0-957.27.2.el7.x86_64) or it failed to\n load. Please recompile the kernel module and install it by\n\n sudo /sbin/vboxconfig\n\n You will not be able to start VMs until this problem is fixed.\n6.0.12r133076". Please upgrade at https://www.virtualbox.org
因为minikube未启动成功,所以kubelet service的状态也是failed。
解决方法:输入/sbin/vboxconfig查看详细报错信息
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-862.11.6.el7.x86_64
原因在于Please install the Linux kernel “header” files matching the current kernel
执行命令
yum install kernel-devel
再次执行/sbin/vboxconfig
完美解决~~
然后执行minikube start启动,成功~
[root@localhost admin]# minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.199.131
此时查看systemctl status kubelet service
[root@localhost admin]# systemctl status kubelet service
● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/usr/lib/systemd/system/kubelet.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: active (running) since Wed 2019-09-18 09:27:12 CST; 4min 42s ago
Docs: http://kubernetes.io/docs/
Main PID: 19061 (kubelet)
Tasks: 19
CGroup: /system.slice/kubelet.service
└─19061 /usr/bin/kubelet --authorization-mode=Webhook --bootstrap-kubecon...
成功~~
更多推荐
已为社区贡献1条内容
所有评论(0)