Creating a Virtual Environment for the OpenShift Platform Using Oracle VirtualBox

Posted: February 23rd, 2014 | Author: | Filed under: Technology | Tags: , | No Comments »

With the base configurations for the virtual machine complete, start the virtual machine by selecting the machine from the VirtualBox Manager and clicking Start. This will attempt to boot the machine using the operation system media previously specified. A typical installation of the operating system can be completed without any special configurations. Ignore any configurations related to networking components as they will be manually configured after the installation completes. Choose an installation of a basic server when given the option as the OpenShift platform does not require the installation of a graphical user interface and the following instructions assumes a basic server has been installed.

With the installation of the operating system complete, we need to configure the networking components on each machine before additional configurations and the installation of OpenShift can be completed. The following instructions will cover how to configure both the broker and node virtual machines with the proper networking configuration to support the OpenShift environment. They are written for either Red Hat Enterprise Linux 5 or 6 or Fedora less than version 17.

First, let’s configure each of the network adapters. Navigate to /etc/sysconfig/network-scripts directory where we will be able to configure each network adapter. Interface eth0 represents the host-only network adapter and allows our guests to communicate with each other and with the host machine. VirtualBox provides a DHCP server to allocate IP addresses for machines configured host-only networking mode. We will configure each virtual machine with a static IP address that falls outside of the default assignable DHCP range (192.168.56.2-192.168.56.99) to ensure our machines consistently utilize the same network address.

For the purposes of this discussion, eth0 on each virtual machine will be configured with the following IP addresses:

  • Broker: 192.168.56.10
  • Node: 192.168.56.11

Make the following modifications on each machine to the file ifcfg-eth0

  • Change ONBOOT to yes to activate the interface at boot
  • Change BOOTPROTO from dhcp to none (Earlier versions required the directive “static”)
  • Change NM_CONTROLLED from yes to no to prevent the NetworkManager from controlling the device
  • Add IPADDR to represent the static IP address for the interface (specify a different address for each machine)
  • Add NETMASK to represent the subnet mask

An example is shown below

DEVICE=eth0
HWADDR=<varies>
TYPE=Ethernet
UUID=<varies>
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=<192.168.56.10 or 192.168.56.11>
NETMASK=255.255.255.0

Next, we will configure the second adapter, configured using NAT networking mode, to connect to external resources on the Internet. Typically, adapters using NAT are configured in a 10.0.2.0 network. However, since the machines utilize NAT as their second adapter, it will instead use the 10.0.3.0 network. Within each NAT network, VirtualBox allocates a default set of IP addresses to provide key resources for virtual machines. The following lists these resources:

  • Default guest IP address: 10.0.x.15
  • Default DNS: 10.0.x.3
  • Default Gateway: 10.0.x.2

Each machine configured in a NAT configuration is isolated from other virtual machines which allows for the reuse of the same IP address across multiple virtual machines. Configure the eth1 interface of each machine to utilize the 10.0.3.15 IP address by editing the contents of the ifcfg-eth1 file as follows:

DEVICE=eth1
HWADDR=<varies>
TYPE=Ethernet
UUID=<varies>
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=10.0.3.15
NETMASK=255.255.255.0

Next, we will configure our virtual machines to connect to the Domain Name System (DNS) by modifying the resolver configuration file located at /etc/resolv.conf. We will utilize the Google Public DNS to support our virtual machines. Configure the resolver file with the following:

nameserver 8.8.8.8

Finally, we need to configure the virtual machines to connect to external networks by configuring the default gateway address. As mentioned earlier, the default gateway for the NAT networking mode is located at 10.0.x.2. Add the following line to the network configuration file located at /etc/sysconfig/network

GATEWAY=10.0.3.2

Once these configurations have been applied, restart the virtual machines for the settings to take effect.

With the configurations in place, lets go ahead and validate connectivity. First, ping each guest machine from the host machine by opening up a terminal on the host machine and running the following commands:

# ping 192.168.56.10
# ping 192.168.56.11

If the command returns a response and no time outs are indicated, host-only networking has been successfully configured. To validate NAT connectivity, we can first attempt to ping the Google Public DNS server configured earlier, then attempt name resolution against this server. From each guest machine, issue the following command to ping the Google Public DNS server:

# ping 8.8.8.8

A successful response indicates the default gateway is properly applied. To validate name resolution, attempt to resolve the IP address of google.com using the host command:

# host google.com

A response similar to the following indicates DNS configurations have been applied successfully.

google.com has address 74.125.225.34
google.com has address 74.125.225.35
google.com has address 74.125.225.39
google.com has address 74.125.225.38
google.com has address 74.125.225.40
google.com has address 74.125.225.41
google.com has address 74.125.225.37
google.com has address 74.125.225.32
google.com has address 74.125.225.33
google.com has address 74.125.225.36
google.com has address 74.125.225.46
google.com has IPv6 address 2607:f8b0:4009:800::1003
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.

At this point, both virtual machines representing the broker and node instances for an OpenShift environment have been initially configured. To continue the full installation of OpenShift, consult the deployment guide which will describe the steps for installing and configuring OpenShift for your newly created virtual environment.



Leave a Reply