This is the fastest way to get going with Fabric8 and OpenShift on your laptop.
First clone the fabric8 installer git repository repository and type these commands:
$ git clone https://github.com/fabric8io/fabric8-installer.git $ cd fabric8-installer/vagrant/openshift-latest
Depending on your host operating system you need to install an additional vagrant plugin:
vagrant plugin install landrushfor Linux and OS X
vagrant plugin install vagrant-hostmanager-fabric8for Windows
The next steps are needed for proper routing from the host to OpenShift services which are exposed via routes:
dnsmasqDNS proxy locally. The detailed procedure depend on the Linux distribution used. Here is the example for Ubuntu:
sudo apt-get install -y resolvconf dnsmasq sudo sh -c 'echo "server=/vagrant.dev/127.0.0.1#10053" > /etc/dnsmasq.d/vagrant-landrush' sudo service dnsmasq restart
%WINDIR%\System32\drivers\etc\hosts. For your convenience, a set of routes for default Fabric8 applications has been pre-added. For new services look for the following line and add your new routes (
<service-name>.vagrant.f8) to this file on a new line like this:
## vagrant-hostmanager-start id: 9a4ba3f3-f5e4-4ad4-9e80-b4045c6cf2fc 172.28.128.4 vagrant.f8 fabric8.vagrant.f8 fabric8-master.vagrant.f8 jenkins.vagrant.f8 ..... 172.28.128.4 myservice.vagrant.f8 ## vagrant-hostmanager-end
*.vagrant.f8to your Vagrant VM. This is done vial OS X's resolver feature (see
man 5 resolverfor details)
Now startup the Vagrant VM
Note the vagrant image is by default configured with 2 cpu cores and 4gb of memory. It is recommended to not exceed about half of your machine’s resources. In case you have plenty of resources on your machine you can increase the settings, by editing the
Vagrantfile. The settings are defined in the bottom of the file:
v.memory = 4096 v.cpus = 2
Then follow the on screen instructions.
You should now have a running vagrant image running at IP address
172.28.128.4 or at
Downloading the docker images may take a few minutes so you might want to jump ahead to the Setting up your local machine then coming back here when you're done.
When you first open your browser Chrome will say:
Your connection is not private
Advancedlink on the bottom left
Proceed to fabric8.vagrant.f8 (unsafe)bottom left
When you are on the
Apps tab in the fabric8 console click on the
This will list all of the installed OpenShift Templates on your installation.
Runbutton (the green play button).
You can also install other OpenShift Templates or Kubernetes resources via the oc command line tool:
oc create -f jsonOrYamlFileOrUrl
Its useful being able to use the command line tools in OpenShift or using fabric8 maven tooling or reusing the docker daemon inside vagrant; so that all images built are accesible inside the OpenShift environment.
Follow these steps:
Set the following environment variables
Unix flavored OSs:
export KUBERNETES_DOMAIN=vagrant.f8 export DOCKER_HOST=tcp://vagrant.f8:2375
set KUBERNETES_DOMAIN=vagrant.f8 set DOCKER_HOST=tcp://vagrant.f8:2375
It is probably a good idea to add this into your
~/.profile (Linux, OS X) or System -> Advance System Settings -> Environment Variables (Windows)
oc login https://172.28.128.4:8443
Over time your token may expire and you will need to re-authenticate via:
Now to see the status of the system:
oc get pods
or you can watch from the command line via one of these commands:
watch oc get pods oc get pods --watch
Have fun! We love feedback
Note: in case you already ran the above and want to update to the latest vagrant image, OpenShift and Fabric8 release you need to destroy and recreate the vagrant image. You can do that using:
vagrant destroy -f git pull vagrant up
oc command can be really useful for viewing resources (pods, services, RCs, templates etc) and deleting pods so they get recreated, looking at logs etc.
If you add the
fabric8-installer/bin folder to your
$PATH then there are a few handy shell scripts
oc-bash namefinds the first pod with the given name pattern and runs a bash shell in the docker container
oc-log namefinds the first pod with the given name pattern and shows the container's log
On your host machine or inside the vagrant image you should have access to docker thanks to the environment variable:
So you should be able to run things like
docker ps docker log nameOfContainer
You can SSH into the vagrant image using:
Then you can look around.
If you hit any issues then try look at the logs for the
vagrant ssh sudo journalctl -u openshift
Or you can tail the logs via
vagrant ssh sudo journalctl -fu openshift
You can watch the docker daemon too via
vagrant ssh sudo journalctl -fu docker