티스토리 뷰

카테고리 없음

vagrant K8S 설치하기

미니대왕님 2024. 5. 27. 14:44

2023.08.08 - [분류 전체보기] - 오픈소스 쉽게 설치 사용설명 1탄! (참고하기)

 

REPO 중요주소 변경함. 

4. local-iac-main.zip
0.06MB

#gg_pkg="packages.cloud.google.com/yum/doc" # Due to shorten addr for key
gg_pkg="http://mirrors.aliyun.com/kubernetes/yum" # Change address Due to shorten addr for key

baseurl=${gg_pkg}/repos/kubernetes-el7-x86_64

gpgkey=${gg_pkg}/doc/yum-key.gpg ${gg_pkg}/doc/rpm-package-key.gpg

 

# Base Image
BOX_IMAGE = "ubuntu/focal64"
BOX_VERSION = "20211026.0.0"

# max number of worker nodes
N = 2

Vagrant.configure("2") do |config|
#-----Manager Node
    config.vm.define "k8s-m" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.name = "Flannel-k8s-m"
        v.memory = 2048
        v.cpus = 2
        v.linked_clone = true
      end
      subconfig.vm.hostname = "k8s-m"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.100.10"
      subconfig.vm.network "forwarded_port", guest: 22, host: 50010, auto_correct: true, id: "ssh"
      subconfig.vm.provision "shell", path: "https://raw.githubusercontent.com/gasida/NDKS/main/3/init_cfg.sh", args: N
      subconfig.vm.provision "shell", path: "https://raw.githubusercontent.com/gasida/NDKS/main/3/master.sh"
    end

#-----Worker Node
  (1..N).each do |i|
    config.vm.define "k8s-w#{i}" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.name = "Flannel-k8s-w#{i}"
        v.memory = 1536
        v.cpus = 2
        v.linked_clone = true
      end
      subconfig.vm.hostname = "k8s-w#{i}"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.100.10#{i}"
      subconfig.vm.network "forwarded_port", guest: 22, host: "5001#{i}", auto_correct: true, id: "ssh"
      subconfig.vm.provision "shell", path: "https://raw.githubusercontent.com/gasida/NDKS/main/3/init_cfg.sh", args: N
      subconfig.vm.provision "shell", path: "https://raw.githubusercontent.com/gasida/NDKS/main/3/worker.sh"
    end
  end

end
댓글