Minikube安装在Ubuntu vm_VT-X / AMD-v中,可以在另一个VM内部启用VM

时间:2017-02-17 09:35:34

标签: ubuntu kubernetes minikube

我想在Ubuntu vm中安装minikube(在虚拟框中)。我为vm启用了VT-X / AMD-v。但是我得到了以下错误。

private onRefresh = new Subject<ElementItemValueModel>();
onRefresh$ = this.onRefresh.asObservable();

我找到了reference,据此,我们无法在虚拟化中进行虚拟化。这是真的吗?我该如何解决这个问题?

7 个答案:

答案 0 :(得分:20)

Virtual Box不支持嵌套虚拟化中的VT-X / AMD-v 。在virtualbox.org上查看此开放ticket/feature request

此处还有一些关于SO this topic的问题和答案。

可能的解决方案:

  1. 如前所述:使用支持VT-X / AMD-v的其他虚拟机管理程序嵌套虚拟化(如Xen,KVM或VMware)。
  2. 在主机操作系统上安装Minikube ,而不是在虚拟机中安装。
  3. 直接使用Docker和“无”驱动程序选项运行Minikube,如Tad Guskis answer中所述。

答案 1 :(得分:16)

使用Docker和不需要嵌套虚拟化的“无”驱动程序选项直接在VM上运行Minikube。

设置无驱动程序选项:

[root@minikube ~]# minikube config set vm-driver none

按照适用于您的VM OS版本的说明安装Docker-ce。

最后运行minikube start:

[root@minikube ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@minikube ~]# systemctl start docker
[root@minikube ~]# minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
===================
WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS
        The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks

When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory.
You will need to move the files to the appropriate location and then set the correct permissions.  An example of this is below:

        sudo mv /root/.kube $HOME/.kube # this will write over any previous configuration
        sudo chown -R $USER $HOME/.kube
        sudo chgrp -R $USER $HOME/.kube

        sudo mv /root/.minikube $HOME/.minikube # this will write over any previous configuration
        sudo chown -R $USER $HOME/.minikube
        sudo chgrp -R $USER $HOME/.minikube

This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
Loading cached images from config file.

答案 2 :(得分:4)

尝试在不使用嵌套虚拟化的情况下运行minikube(应安装docker):

minikube start --vm-driver=none

来自Kubernetes documentation

  

Minikube还支持--vm-driver = none选项,该选项可运行   Kubernetes组件位于主机而不是VM中。使用此驱动程序   需要Docker和linux环境,但不需要管理程序。

答案 3 :(得分:3)

检查VM是否正确启用(在VM内运行):

egrep -i '^flags.*(svm|vmx)' /proc/cpuinfo

在VM内核中:

dmesg | egrep 'DMAR|IOMMU'

仅使用32位嵌套来宾, ,因此请检查(它不支持支持嵌套来宾,但可以使用32位):

uname -m

答案 4 :(得分:2)

“在主机操作系统上安装Minikube,而不是在虚拟机中安装。”

它并不完全正确,实际上你可以在Linux VM上安装minikube,而不是驱动程序选项,它使用localkube直接处理VM主机docker中的kubernetes。

你可以在Linux VM中使用这个小脚本在几分钟内启动minikube。

https://github.com/robertluwang/docker-hands-on-guide/blob/master/minikube-none-installation.md

答案 5 :(得分:1)

我安装了VM ware并在VM中安装了Virtualbox。并在外部VM中启用VT-X / AMD-v。它的工作正常。

答案 6 :(得分:0)

在virtualbox .vmx文件中设置以下属性。

登录esx框并找到您的VM的* .vmx文件。

例如:

echo 'vhv.enable = "TRUE"' >> /vmfs/volumes/54183927-04f91918-a72a-6805ca147c55/ubun204_mk/ubun204_mk.vmx 

然后运行 迷你库开始

祝你好运!