From 2b49f918c929d2c675cbaa035dd3db2df27c76e9 Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Wed, 7 Mar 2018 04:01:44 -0700 Subject: [PATCH] Fix Vagrant data file Update machines.yml with correct information. Update README.md with preliminary instructions. Signed-off-by: Scott Lowe --- kubernetes/kubeadm-vagrant/README.md | 28 +++++------------ kubernetes/kubeadm-vagrant/machines.yml | 42 +++++++------------------ 2 files changed, 20 insertions(+), 50 deletions(-) diff --git a/kubernetes/kubeadm-vagrant/README.md b/kubernetes/kubeadm-vagrant/README.md index 6087d66..d9964d0 100644 --- a/kubernetes/kubeadm-vagrant/README.md +++ b/kubernetes/kubeadm-vagrant/README.md @@ -1,6 +1,6 @@ -# Docker Swarm Mode with CoreOS +# Local Kubernetes Cluster with Kubeadm -These files were created to allow users to use Vagrant ([http://www.vagrantup.com](http://www.vagrantup.com)) quickly and relatively easily test Docker "Swarm Mode" using CentOS Atomic Host. This environment was tested using Vagrant 1.9.1 with VirtualBox 5.1.14, but should work with Vagrant's VMware provider as well. +These files were created to allow users to use Vagrant ([http://www.vagrantup.com](http://www.vagrantup.com)) quickly and relatively easily spin up a local Kubernetes cluster that is bootstrapped using `kubeadm`. ## Contents @@ -14,28 +14,16 @@ These files were created to allow users to use Vagrant ([http://www.vagrantup.co These instructions assume you've already installed your virtualization provider (VMware Fusion/Workstation or VirtualBox), Vagrant, and any necessary plugins (such as the Vagrant VMware plugin). Please refer to the documentation for those products for more information on installation or configuration. -1. Use `vagrant box add` to install the CentOS Atomic Host box. For VirtualBox, you can use `vagrant box add centos/atomic-host`. Users of a VMware virtualization provider will likely need to create their own Vagrant box. +1. Use `vagrant box add` to install an Ubuntu 16.04 base box. Review `machines.yml` for some suggested boxes for both VirtualBox and VMware virtualization platforms. -2. Place the files from the `docker/atomic-swarm-mode` directory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (using `git clone`) or just download the specific files from the the `docker/atomic-swarm-mode` folder. +2. Place the files from the `kubernetes/kubeadm-vagrant` directory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (using `git clone`) or just download the specific files from the the `kubernetes/kubeadm-vagrant` folder. -3. If the name of your CentOS Atomic Host Vagrant box is _not_ "centos/atomic-host", edit `machines.yml` to supply the correct box name. This file has separate lines for the VirtualBox and VMware providers; be sure to edit the correct line for your provider. +3. If the name of your Ubuntu 16.04 base box is _not_ one of the ones listed in `machines.yml`, edit `machines.yml` to supply the correct box name(s). This file has separate lines for the VirtualBox and VMware providers; be sure to edit the correct line for your provider. -4. Run `vagrant up` to instantiate 4 VMs---one manager and three workers. All the VMs will be running CentOS Atomic Host. +4. Run `vagrant up` to instantiate 3 VMs---one manager and two nodes. All the VMs will be running Ubuntu 16.04. -5. Once Vagrant is finished, use `vagrant ssh manager` to log into the manager VM. +5. Once Vagrant is finished, use `vagrant ssh master` to log into the manager VM. -6. Edit the `/etc/docker/daemon.json` file to specify "live-restore" is false (change from true). Restart the Docker daemon with `sudo systemctl restart docker` in order for that change to take effect. (This setting is incompatible with Docker's Swarm mode.) - -7. While logged into the manager VM, run `docker swarm init --advertise-addr 192.168.100.100` to create a new swarm. If you have edited the IP addresses supplied in `machines.yml`, then you'll need to adjust the command accordingly to use the IP address supplied for the manager VM. - - The output of that command will provide a command-line to use to join worker nodes to the swarm. Copy and paste this output; you'll need it shortly. - -8. Log out of the VM and use `vagrant ssh worker-01` to log in to the first worker VM. Repeat step #6 to make the Docker daemon ready to join the Swarm. - -9. Paste the output of step #7 to have the worker node join the swarm. - -10. Repeat steps #8 and #9 for the remaining worker nodes. - -11. Use `vagrant ssh manager` to log back into the manager VM. Run `docker node ls` to show the Docker Engine instances participating in the swarm. +6. Enjoy! diff --git a/kubernetes/kubeadm-vagrant/machines.yml b/kubernetes/kubeadm-vagrant/machines.yml index 9a4c460..1952257 100644 --- a/kubernetes/kubeadm-vagrant/machines.yml +++ b/kubernetes/kubeadm-vagrant/machines.yml @@ -1,46 +1,28 @@ --- - box: - vmw: "centos/atomic-host" - vb: "centos/atomic-host" - name: "manager" + vmw: "generic/ubuntu1604" + vb: "ubuntu/xenial64" + name: "master" nics: - type: "private_network" ip_addr: "192.168.100.100" - ram: "512" + ram: "2048" vcpu: "1" - box: - vmw: "centos/atomic-host" - vb: "centos/atomic-host" - name: "worker-01" + vmw: "generic/ubuntu1604" + vb: "ubuntu/xenial64" + name: "node-01" nics: - type: "private_network" ip_addr: "192.168.100.101" - ram: "512" + ram: "2048" vcpu: "1" - box: - vmw: "centos/atomic-host" - vb: "centos/atomic-host" - name: "worker-02" + vmw: "generic/ubuntu1604" + vb: "ubuntu/xenial64" + name: "node-02" nics: - type: "private_network" ip_addr: "192.168.100.102" - ram: "512" - vcpu: "1" -- box: - vmw: "centos/atomic-host" - vb: "centos/atomic-host" - name: "worker-03" - nics: - - type: "private_network" - ip_addr: "192.168.100.103" - ram: "512" - vcpu: "1" -- box: - vmw: "centos/atomic-host" - vb: "centos/atomic-host" - name: "worker-04" - nics: - - type: "private_network" - ip_addr: "192.168.100.104" - ram: "512" + ram: "2048" vcpu: "1"