The following tutorial enables you to run a simple single node Kubernetes cluster on your Mac laptop or desktop using PMK.
This type of setup is useful for:
Here is a summary of the steps involved:
On macOS, there are two popular ways to install VirtualBox.
The first is to download the latest edition of VirtualBox for your platform. At the time of this writing, it is version 6.1.2 for macOS
Once the file is downloaded, it will be in the ‘Downloads’ folder. Mount the DMG file by double-clicking on it, which will launch another window that contains the actual installer. That installer is called VirtualBox.pkg.
Launch VirtualBox.pkg and follow through the next installation steps.
Step 1b. Click “Continue” to allow the prerequisite checks.
Step 1c. Continue the installation by clicking “Install” on the bottom left. It will prompt for a password for admin access to update the network configuration.
Step 1d. Once install is successful, Click “Close” on the installer wizard. VirtualBox is now installed and ready to be used.
On macOS, there is a developer focused community project called Homebrew (https://brew.sh/) that provides a locally installed utility that can be used to install and update projects provided by the community.
VirtualBox is available via this method and can be installed with a single command line.
MacBook-Air
~ % brew cask install virtualbox
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.
==> Caveats
To install and/or use virtualbox you may need to enable its kernel extension in:
System Preferences → Security & Privacy → General
For more information refer to vendor documentation or this Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
==> Downloading https://download.virtualbox.org/virtualbox/6.1.2/VirtualBox-6.1.2-135662-OSX.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'virtualbox'.
==> Installing Cask virtualbox
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is Oracle VM VirtualBox
installer: choices changes file '/var/folders/s2/yg_q89zd1xx14mq8fv1bshpc0000gn/T/choices20200123-15967-1nzasnl.xml' applied
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Changing ownership of paths required by virtualbox; your password may be necessary
🍺 virtualbox was successfully installed!
In a web browser, go to http://releases.ubuntu.com/18.04/ and scroll down to the “Server” download section to get the “64-bit PC (AMD64) server install image” image. This will take a few minutes, as it is 873Mb.
In the Application folder, users will see VirtualBox listed there.
Launch VirtualBox. It will be a clean slate to start building your new virtual machine.
Next, click the blue “New” button to create a new virtual machine. Select Linux and Ubuntu for the options, and choose a name that makes sense for you.
PMKFT recommends 16Gb of RAM and 4 cores per server node. Since this is a local test environment, not a full server, those are not strictly needed; but, the more memory you can allocate, the better the system will perform. MacBook Pro and iMacs routinely have 16 GB of RAM, so allocating 8 GB would be ideal for almost all test scenarios.
Next, let it create a virtual disk (it doesn’t matter which format) and dynamically allocate the space. The more disk space you can allocate, the better. 20 GB fills up fast when you start to play with container images in Kubernetes. Click “Create” after going through these screens.
Now you have a completed image, ready to start.
The first time the new virtual machine starts up, it will want the location of the ISO file that it will install from.
Select your language and then choose to “Install Ubuntu Server”
Select your language again, followed by country; tell it to not detect the keyboard layout, and select the appropriate keyboard. If you don’t really care and have a standard US English setup, then press enter four times, and it will start the installation.
After installation completes, add a hostname.
Next, add a username and password.
Users can accept the defaults for the next several screens, including ‘not to encrypt the home directory,’, and ‘ _to use LVM for disks_’ since it is a test box.
The screen after it will require you to select “Yes” to write the changes to the disk. The default is “No,” so you can’t just blindly continue.
Same with the next sequence – you can accept the defaults until the screen where it wants you to confirm, “Yes” to continue.
The next screen that prompts for information asks for a proxy, which you can just leave empty to continue.
Select whether you want the instance to patch itself.
Select whether you want any packages. The default selection is an acceptable answer; no additional packages are required.
Allow it to install the GRUB bootloader.
And we have a fully functional Ubuntu 18.04 LTS server that just needs to restart.
Now you can use this server to create a single node PMK cluster.
By default, you will not be able to ssh into this VM, even from the host. To enable ssh access, you need to install sshd in the VM and make changes to the VM’s networking configuration to allow ssh access from outside.
xxxxxxxxxx
sudo apt-get update
sudo apt-get install openssh-server
Ssh is now configured on the VM, but the VM is still not accessible from outside. This is because the VM we just created is configured with NAT as the default networking option. In this configuration, we need to enable port forwarding for the VM and forward port 22 (the ssh port) to the host level, so that any ssh requests for the VM can be received at the host level and routed to the VM.
xxxxxxxxxx
ssh yourusername@127.0.0.1 -p 2222
Your ssh access is now configured!
xxxxxxxxxx
bash <(curl -sL https://pmkft-assets.s3-us-west-1.amazonaws.com/pf9ctl_setup)
xxxxxxxxxx
pf9ctl prep-node
When the prep-node command completes, you can return to the Platform9 SaaS Management Plane and build your cluster.