This is an old revision of the document!


Kubernetes is the next Evolution of Docker swarm, so in order to configure it, we have to firstly configure the Docker (just without the swarm this time) We will configure 3 servers again:

  • One master
  • Two Workers

So let's get going:

You can return use the first section of the Vagrant advanced configurations or you can continue here, where we will do pretty much the same. I like wasting space :D

So let's get going with Vagrant again :)

Kubernetes Vagrantfile

IMAGE_NAME = "centos/7"
N = 2

Vagrant.configure("2") do |config|
    config.ssh.insert_key = false

    config.vm.provider "virtualbox" do |v|
        v.memory = 1024
        v.cpus = 2
    end
      
    config.vm.define "k8s-master" do |master|
        master.vm.box = IMAGE_NAME
        master.vm.network "private_network", ip: "192.168.50.10"
        master.vm.hostname = "k8s-master"
        master.vm.provision "ansible" do |ansible|
            ansible.playbook = "kubernetes-setup/master-playbook.yml"
            ansible.extra_vars = {
                node_ip: "192.168.50.10",
            }
        end
    end

    (1..N).each do |i|
        config.vm.define "node-#{i}" do |node|
            node.vm.box = IMAGE_NAME
            node.vm.network "private_network", ip: "192.168.50.#{i + 10}"
            node.vm.hostname = "node-#{i}"
            node.vm.provision "ansible" do |ansible|
                ansible.playbook = "kubernetes-setup/node-playbook.yml"
                ansible.extra_vars = {
                    node_ip: "192.168.50.#{i + 10}",
                }
            end
        end
    end
  • vagrant_kubernetes_install.1583781707.txt.gz
  • Last modified: 2020/03/09 19:21
  • by andonovj