VirtualBox

satrapu edited this page Oct 14, 2017 · 10 revisions

This page details how to run Rancher server and 2 agents on VMs created via Oracle VirtualBox.

Prerequisites

  • Install VirtualBox, if you haven't done so already.
    In case your host is running Windows 10 Pro + Hyper-V, please remove this hypervisor before running any VirtualBox VMs!
  • Have the ability of accessing a machine using SSH

VirtualBox Virtual Machines

# VM Name Role OS CPU Cores RAM (MB) Disk (GB) Comments
1 rs Rancher server CoreOS 2 1024 10
  • VirtualBox → VM Settings → Network → Adapter 1: NAT
  • VirtualBox → VM Settings → Network → Adapter 2: Bridged Adapter
2 ra1 Rancher agent 2048 20
3 ra2 Rancher agent 2048 20
Hard disk file type: VDI (VirtualBox Disk Image)
Storage on physical hard disk: Dynamically allocated

VirtualBox VM Installation Steps

In case your host is running Windows 10 Pro + Hyper-V, please remove this hypervisor before running any VirtualBox VMs!

  1. Specify name and operating system
  2. Specify file location
  3. Specify amount of RAM
  4. Specify number of CPU cores
  5. Enable network adapter: NAT
  6. Enable network adapter: Bridged Adapter
  7. Mount CoreOS ISO
  8. Start VM

CoreOS Installation Steps

CoreOS is a OS which was built specifically for hosting Docker containers; it not officially supported by Rancher server.

Follow the steps below when creating one VM for hosting Rancher server and another one for hosting one Rancher agent, then, for each additional agent, just clone the VM hosting the first agent!

  1. Start VM from VirtualBox GUI
  2. Generate password inside cloud-config.yml file
    sudo openssl passwd -1 > cloud-config-file
  3. Edit cloud-config.yml file
    vi cloud-config.yml
  4. Cloud-config.yml contents
    #cloud-config
      
    users:
    - name: rancher
      passwd: <PASSWORD_HASH>
      groups:
      - sudo
      - docker
  5. Install CoreOS
    sudo coreos-install -d /dev/sda -C stable -c cloud-config.yml
  6. Shutdown machine
    sudo shutdown -h now
  7. Unmount CoreOS ISO from VirtualBox GUI
  8. Start VM from VirtualBox GUI
  9. Login using rancher/rancher (or the credentials you have previously set)
  10. Display VM IP v4 Address (something like 192.168....)
    ip addr | less
  11. Optionally, change the hostname accordingly
    sudo vi /etc/hostname
      
    # add the new hostname, e.g. rs for Rancher server host or ra1 for Rancher agent #1 host
      
    sudo reboot
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.