Prepare Virtual Machine using Virtualbox and Ubuntu
pongsatt
Posted on November 3, 2018
This post will guide you to create 4 virtual machine based on Ubuntu Server. One designated to be kubernetes master node and the other three as worker nodes.
This is part of Setup your own kubernetes cluster on VMs series.
Note:
This guide is based on Windows but since it's a virtual machine, others OS shouldn't be different
Prerequisite:
- Install VirtualBox
- Download Ubuntu 16.04 Image for VirtualBox or 64bit Direct link
- Available 2GB of RAM per VM (4 nodes will need at 8GB). You can reduce number of nodes depending on your available RAM
- 10-30GB of disk space per VM (4 nodes will need around 100GB)
In the end
You will get something like this.
1. Create Virtual Machine
We will create 4 virtual machines. 1 machine is for kubernetes master and the reset for worker node. They're all mostly the same except hostname. RAM and cpu can be adjusted based on your need. In theory, master node will need less resource comparing to worker node.
1.1. Create New Virtual Machine
Name: k8smaster
Type: linux
Memory: 2048MB
1.2. Choose harddisk size
Size: 10GB
2. Prepare VM before install OS
2.1. Setup network
We will use bridge network so we have the real network ip address that can talk to the outside world.
- Click "Settings" then "Network".
- Select "Attached to" as "Bridged Adapter"
- Click "Advance"
- Write down "MAC Address" to reserve IP address so that your IP will not change every time the VM restarted
2.2. Setup Ubuntu image to be installed
- Click "Settings" then "Storage"
- Click "Adds optical drive" at the top right corner
- Select os image (.iso) you downloaded
- Click OK
3. Create the rest VMs
Repeat step 1 and 2 with below information
- Name: kubenode1, kubenode2, kubenode3
- RAM: 2048GB (or more)
- Disk: 32GB (or less)
4. Setup Ubuntu
4.1 Start VM (kubemaster)
Click "Start" button icon.
Ubuntu setup screen will be shown as below.
Select "Install Ubuntu Server
4.2 Set Hostname
Follow instructions until this screen and fill "kubemaster" as hostname.
4.3 Set user name
Fill in "Full name", "username" and "password" as needed. Please make note these information.
4.4 Other information
- "Encrypt your home directory?" : No
- "Partition disk" : "Guided - use entire disk"
- "Write the changes to disks?" : Yes
- "HTTP proxy information" : leave blank (if you are outside company proxy)
- "How do you want to manage upgrades on this system?" : No automatic updates
- "Software selection" : select "OpenSSH server" (This is required if you want you connect to your server remotely using ssh command)
4.5 Install GRUB boot loader
Select "Yes" then "Finish Installation"
5. Setup Ubuntu for the rest VMs
Repeat step 4 for "kubenode1" to "kubenode3"
Note:
- Don't forget to change hostname to "kubenode1" to "kubenode3" in step 4.2
- Username and password can be the same for all VMs
Summary
Now, you have all the VMs with network and ready to setup kubernetes cluster in the next step.
Posted on November 3, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.