【问题标题】:How to start minikube?如何启动 minikube?
【发布时间】:2017-09-10 14:10:07
【问题描述】:

我在 Thinkpad X201i 上的 Linux 机器 Lubuntu 16.04 上安装了 minikube

这是我的完整安装步骤:

Download and install the minikube server
cd programs/install/bin
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64;
chmod +x minikube;

Download and install the kubectl client
cd programs/install/bin
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x kubectl;

Install the libraries libvirt and qemu-kvm
sudo apt-get install libvirt-bin qemu-kvm
(NOTE: For Ubuntu 17.04 change the group to libvirt)
sudo usermod -a -G libvirtd $(whoami)
newgrp libvirtd

Install Docker Machine
cd /home/stephane/programs/install/bin
curl -L https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` > docker-machine;
chmod +x docker-machine

Install the KVM driver for Docker Machine
cd /home/stephane/programs/install/bin
curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-ubuntu16.04 > docker-machine-driver-kvm;
chmod +x docker-machine-driver-kvm

系统重启后,集群似乎已启动:

$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
$ minikube ip
$

我对此感到惊讶,因为我没有创建任何服务来启动它。

如果启动了,那为什么没有IP呢?

我在/etc/init.d/目录中查找:

$ ll -t /etc/init.d/*virt*
-rwxr-xr-x 1 root  17K août  23 14:47 /etc/init.d/libvirt-guests*
-rwxr-xr-x 1 root 5,9K août  11 07:50 /etc/init.d/libvirt-bin*
-rwxr-xr-x 1 root 4,0K août  11 07:50 /etc/init.d/virtlockd*
-rwxr-xr-x 1 root 3,9K août  11 07:50 /etc/init.d/virtlogd*
$ ll -t /etc/init.d/docker 
-rwxr-xr-x 1 root 3,8K mai    4 23:36 /etc/init.d/docker*

它不能是启动我的minikube 的 docker 守护进程,因为我的 docker 中没有图像:

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

一开始是想手动启动。

但是当我这样做时,它会显示尝试启动,但由于查找不存在的图像而失败:

$ minikube start --vm-driver kvm
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
E0912 18:23:37.989448   24423 start.go:143] Error starting host: Error starting stopped host: virError(Code=38, Domain=18, Message='Cannot access storage file '/root/.minikube/machines/minikube/boot2docker.iso' (as uid:64055, gid:129): Aucun fichier ou dossier de ce type').

我配置了 BIOS 并启用了虚拟化,并且确实启用了加速:

$ sudo /usr/sbin/kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

我承认我将库安装在非标准目录位置: /home/stephane/programs/install/bin

不同命令的一些输出:

$ egrep -c '(vmx|svm)' /proc/cpuinfo
4
$ virsh list --all
 ID    Nom                            État
----------------------------------------------------

它仍然说它正在运行:

$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080

虽然无法连接:

$ kubectl cluster-info dump
The connection to the server localhost:8080 was refused - did you specify the right host or port?

为什么最后两个类似的命令,会给出相反的信号?

更新:我输入了rm -rf ~/.minikube/cache 命令,然后输入了几次minikube start --vm-driver kvm 命令,今天它似乎工作了:

$ minikube start --vm-driver kvm
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Downloading Minikube ISO
 106.36 MB / 106.36 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
$ minikube ip
192.168.42.196

【问题讨论】:

标签: docker kvm minikube


【解决方案1】:

看看你的 docker daemon (docker ps) 上运行的容器,kubernetes 肯定在那里运行。

我从未在 Linux 上测试过 minikube,所以我不确定,但在 Windows 上,它作为容器在 linux vm 中运行。

问候, 蒂博

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-29
    • 2018-02-18
    • 2020-03-13
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 2020-01-25
    • 2019-11-19
    相关资源
    最近更新 更多