运行 Vagrant 时出错

运行 Vagrant 时出错

我正在尝试使用 kubeadm 设置 Kubernetes 集群。作为先决条件,我已经安装了适用于 MacOs Silicon M2 芯片的 VirtualBox。安装后,我尝试运行命令“Vagrant up”,但出现以下错误

    vagrant up      
Bringing machine 'kubemaster' up with 'virtualbox' provider...
Bringing machine 'kubenode01' up with 'virtualbox' provider...
Bringing machine 'kubenode02' up with 'virtualbox' provider...
==> kubemaster: Clearing any previously set forwarded ports...
==> kubemaster: Clearing any previously set network interfaces...
==> kubemaster: Preparing network interfaces based on configuration...
    kubemaster: Adapter 1: nat
    kubemaster: Adapter 2: hostonly
==> kubemaster: Forwarding ports...
    kubemaster: 22 (guest) => 2710 (host) (adapter 1)
    kubemaster: 22 (guest) => 2222 (host) (adapter 1)
==> kubemaster: Running 'pre-boot' VM customizations...
==> kubemaster: Booting VM...
==> kubemaster: Waiting for machine to boot. This may take a few minutes...
    kubemaster: SSH address: 127.0.0.1:2222
    kubemaster: SSH username: vagrant
    kubemaster: SSH auth method: private key
    kubemaster: Warning: Connection reset. Retrying...

我尝试增加config.vm.boot_timeout=1500但仍然没有帮助。

以下是我的 VagrantFile 详细信息

      # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  config.vm.box_check_update = false

  # Provision Master Nodes
  config.vm.define "kubemaster" do |node|
    # Name shown in the GUI
    node.vm.provider "virtualbox" do |vb|
      vb.name = "kubemaster"
      vb.memory = 2048
      vb.cpus = 2
    end
    node.vm.hostname = "kubemaster"
    node.vm.network :private_network, ip: IP_NW + "#{MASTER_IP_START}"
    node.vm.network "forwarded_port", guest: 22, host: "#{2710}"
    provision_kubernetes_node node
    # Install (opinionated) configs for vim and tmux on master-1. These used by the author for CKA exam.
    node.vm.provision "file", source: "./ubuntu/tmux.conf", destination: "$HOME/.tmux.conf"
    node.vm.provision "file", source: "./ubuntu/vimrc", destination: "$HOME/.vimrc"
  end

  # Provision Worker Nodes
  (1..NUM_WORKER_NODE).each do |i|
    config.vm.define "kubenode0#{i}" do |node|
      node.vm.provider "virtualbox" do |vb|
        vb.name = "kubenode0#{i}"
        vb.memory = 1024
        vb.cpus = 1
      end
      node.vm.hostname = "kubenode0#{i}"
      node.vm.network :private_network, ip: IP_NW + "#{NODE_IP_START + i}"
      node.vm.network "forwarded_port", guest: 22, host: "#{2720 + i}"
      provision_kubernetes_node node
    end
  end
end

有人能帮忙提供一些关于错误的见解吗?我是否缺少某些权限,或者机器重启是否存在问题?这是我第一次使用 Vagrant 进行此安装,因此任何帮助解决此问题的帮助都将不胜感激。

谢谢。

相关内容