This guide will help you to deploy a (NON-PRODUCTION) OpenShift 3 instance on top of an existing OpenStack Liberty instance.
This will be a quick run through of how to get it OpenShift up and running, the full documentation can be found here https://docs.openshift.org/. I will be making use of Centos7.2 for the VM images and OpenShift Origin (Upstream opensource version), as well as OpenShift Ansible (https://github.com/openshift/openshift-ansible) to deploy.
(This guide assumes some familiarity with OpenStack, Linux, and that you have a good ability to troubleshoot)
What you will need
- A linux server with the following installed (I used Ubuntu 16.04);
- Ansible (http://docs.ansible.com/ansible/intro_installation.html)
- OpenStack Python Clients
2. Access to an OpenStack environment with the following quota;
- 10 Instances
- 6 Floating IP’s
- 1 Network/Subnet/Router
3.Somewhere you can setup DNS records
First build your linux machine from where you will be running the installation, this can be inside the OpenStack project in which you want to build the OpenShift environment, but will need access to the Nova, Neutron and HEAT endpoints for the OpenStack service you are going to build on-top of.
Once you have the default linux install built and you have connected into it (and fully updated it :)), you will need to install some software packages.
On Ubuntu 16.04 run the following;
sudo apt-get install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible
So that gets Ansible installed and ready to go.
sudo apt-get install pip sudo apt-get install libssl-dev
That gets you ready to install the OpenStack Clients
pip install python-openstackclient sudo apt-get install python-novaclient sudo apt-get install python-heatclient
You will also need to create an SSH key, that will be injected into every one of the OpenShift nodes.
If you already have one, feel free to skip.
ssh-keygen -t rsa -C "firstname.lastname@example.org"
That gets the other pre-reqs out the way.
Prep your Centos7.2 image
During my deploy I had an issue where network manager needed to be started and running for the ansible deploy to work correctly, so spin up a Centos7.2 image in OpenStack, and install networkmanager and set it to run on startup.
sudo yum install NetworkManager sudo sytemctl start networkmanager sudo systemctl enable networkmanager
Shutdown the instance, and take a snapshot of the instance. Give it a useful name, as we will be using that later.
Before we can build we need to do a couple more things. Firstly, either create or grab your openstackrc file (Its available from inside the OpenStack gui, under Project -> Compute -> Access and security, the button is on the right hand side)
Once you have that downloaded, you will need to source that file. It should ask you for your password. Once you have it sourced, run a nova list and make sure the data is returned correctly.
Checking out the repo
Now we have our Auth sorted for our OpenStack environment, we need to checkout the OpenShift-Ansible repo.
On the linux build box
git clone https://github.com/openshift/openshift-ansible.git cd openshift-ansible
Now we have the code, and we are in the directory from which we can execute the build.
I found I needed to make a couple of slight changes to get everything to build (most likely because I didnt read all the doco :D)
First we need to make a files directory, this is where the ansible build will look for the required yaml files to carry out the deploy
Now we need to copy the yaml files we need into this location
Copy the files from openstack-ansible/playbooks/openstack/openshift-cluster/files/ to the files directory you just created.
Now using your editor of choice open files/heat_stack.yaml
In the section dns-content, you should see a section write files, you will need to append the following into that section
- path: /etc/resolv.conf content: | nameserver 184.108.40.206
Make sure you get the formatting correct, use the other stanzas as a guide. I had to put this in, as otherwise the deploy failed due to DNS lookup issues.
We will also need to make a change to the file inventory/openstack/nova.ini
Inside this file you will need to hash out anything apart from the API version.
Now all thats done we should be in a position to deploy. To deploy simply run the following command.
bin/cluster create -t origin \ -n 3 \ -o image_name=<Nameoftheimage> \ -o external_net=<ExternalNetworkName> \ -o floating_ip_pool=<floatingIPName> \ -o master_flavor=<flavorName> \ -o node_flavor=<flavorName> \ -o infra_flavor=<flavorName> \ openstack \ opsv3
In order to use the above command you will need to change the items in <> to real values.
<Nameoftheimage> is the image name of the snapshot you took earlier
<ExternalNetworkName> is the name of the external network you would use to get out to the internet.
<floatingIPName> is the name of the floating IP pool you have access to, normally this will be the same name as the external network name.
<flavorName> is the name of the instance flavor types you want to use. Refer to the doco to get an idea of what you need.
Once you have run the above command, you should hopefully see ansible bringing the stack to life and after a while (35-45 mins) ansible should complete with a block of json with a whole heap of information on it.
One of those pieces of information will be the master node IP, grab that, open your browser and throw https://theip:8443 into the URL bar. If all goes well you should get an OpenShift login page, log into that with admin/admin
With luck you will now be logged in.
This gets you a mostly working OpenShift environment, there are a couple of things to do, mainly;
- Configure Authentication correctly
- Configure Endpoint domains
- Configure DNS
I hope to be adding an additional guide on this over the next few weeks, if your impatient and dont want to wait, remember to hit up the documentation.