002 - k8s -安装k8s集群

002 - k8s -安装k8s集群,第1张

002 - k8s -安装k8s集群 准备宿主机 初始化方式1: 直接在线下载box文件并初始化
vagrant init centos7 https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-1811_02.VirtualBox.box
初始化方式2: box文件下载到本地, 初始化
vagrant box add ../CentOS-7-x86_64-Vagrant-1811_02.VirtualBox.box --name centos7
vagrant box list
Vagrantfile

为master-01/node-01/node-02三个节点分别在文件夹中执行
vagrant init centos7
修改Vagrantfile内容分别如下

Vagrant.configure("2") do |config|
  config.vm.box = "centos7"
  config.vm.hostname = "master1"
  config.vm.synced_folder "./", "/vagrant"
  # config.vm.network "private_network", ip: "192.168.56.50"
  config.vm.network "public_network", ip: "192.168.1.50"
  config.vm.provider "virtualbox" do |v| #分配资源
    v.memory = 2048
    v.cpus = 2
  end
end
Vagrant.configure("2") do |config|
  config.vm.box = "centos7"
  config.vm.hostname = "node1"
  config.vm.synced_folder "./", "/vagrant"
  # config.vm.network "private_network", ip: "192.168.56.51"
  config.vm.network "public_network", ip: "192.168.1.51"
  config.vm.provider "virtualbox" do |v| #分配资源
    v.memory = 2048
    v.cpus = 2
  end
end
Vagrant.configure("2") do |config|
  config.vm.box = "centos7"
  config.vm.hostname = "node2"
  config.vm.synced_folder "./", "/vagrant"
  # config.vm.network "private_network", ip: "192.168.56.52"
  config.vm.network "public_network", ip: "192.168.1.52"
  config.vm.provider "virtualbox" do |v| #分配资源
    v.memory = 2048
    v.cpus = 2
  end
end

之后分别执行

vagrant up
vagrant ssh

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5681782.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存