setup openshift origin cluster on your own machine

RedHat provided a doc for installing openshift origin on your own cluster, however the docs are not that comprehensive
https://docs.openshift.org/latest/welcome/index.html

1) prerequisites
first of all, try to follow the instructions here for the prerequisites
https://docs.openshift.org/latest/install_config/install/prerequisites.html
The first very import thing is that you have to setup your own dns server first, it is not clear in the doc that it is required
basically use one of your hosts to configure as local dns server, e.g. you can use bind9
here is a good reference to configure bind9
https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-centos-7
You can setup the local dns as something like project.openshift.local
configure each every host/node to use your local dns server
e.g.
[[email protected] log]# cat /etc/resolv.conf
# Generated by NetworkManager
search sy.openshift.local
nameserver 10.128.10.10
nameserver 10.128.10.20
nameserver 8.8.8.8

[[email protected] log]# ifconfig
eth0: flags=4163 mtu 1500
inet 10.128.10.11 netmask 255.255.255.0 broadcast 10.128.10.255
inet6 fe80::5054:ff:fe76:e806 prefixlen 64 scopeid 0x20 ether 52:54:00:76:e8:06 txqueuelen 1000 (Ethernet)
RX packets 27520 bytes 2589871 (2.4 MiB)
RX errors 0 dropped 41 overruns 0 frame 0
TX packets 2908 bytes 229605 (224.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2) Host preparation

Here is the reference from the doc https://docs.openshift.org/latest/install_config/install/host_preparation.html
Yum install all the necessary packages and do a yum update after installation
Here is my current setup
master
node1
node2
ns1
have to install all the packages on all the nodes
make sure you can ssh as root from master to the other nodes, you can setup key authentication

on your master server, download the openshift client and server package, available from here
https://github.com/openshift/origin/releases
I put them all under one folder
[[email protected] openshift]# pwd
/data/openshift
[[email protected] openshift]# ls -al
total 39444
drwxr-xr-x. 5 root root 252 Feb 5 13:20 .
drwxr-xr-x. 4 root root 34 Feb 5 13:20 ..
lrwxrwxrwx. 1 root root 56 Feb 5 13:20 client -> openshift-origin-client-tools-v3.7.1-ab0f056-linux-64bit
drwxr-xr-x. 16 root root 4096 Feb 4 12:39 openshift-ansible
drwxr-xr-x. 2 root root 48 Feb 5 13:21 openshift-origin-client-tools-v3.7.1-ab0f056-linux-64bit
-rw-r–r–. 1 root root 40380234 Jan 16 12:48 openshift-origin-client-tools-v3.7.1-ab0f056-linux-64bit.tar.gz
drwxr-xr-x. 4 root root 4096 Feb 3 09:37 openshift-origin-server-v3.7.1-ab0f056-linux-64bit
lrwxrwxrwx. 1 root root 50 Feb 5 13:20 server -> openshift-origin-server-v3.7.1-ab0f056-linux-64bit

go to client and server folder to add the PATH
cd client
export PATH=$(pwd):$PATH
cd ../server
export PATH=$(pwd):$PATH

This will add the openshift related binaries to the PATH, so you can call the oc command

git clone https://github.com/openshift/openshift-ansible to /data/openshift folder also, you need this for RPM install later on

docker setup
Make sure you install docker 1.12.6
on my centos 7, i just used yum install docker, and it is the right docker version.

For docker-storage-setup, you better use the option A as in the doc, since actually I have all my hosts/nodes running on KVM, I just attached a device to each node as /dev/vdb, and use it for the docker-storage-setup
a good reference here for setting up kvm
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/virtualization_deployment_and_administration_guide

3) Install atomic and openshift stuff
yum install atomic
yum install atomic-openshift-utils

common virsh commands

As a rule, do not run any virsh commands as a background process as timeouts and errors can occur at unpredictable times.
Table 1. Common virsh command options: storage
Command option Description
virsh find-storage-pool-sources Creates an XML definition file for all storage pools of a specific type.
virsh pool-define-as pool_name path mountpoint Create a storage pool. Provide the name, the path to the storage, and a mount point on the local system.
virsh pool-list Lists all storage pools. To include inactive storage pools, add –all.
virsh pool-build pool_name Creates a mount point for the storage pool.
virsh pool-start pool_name Starts the storage pool
virsh pool-autostart pool_name Causes the pool to be started every time that libvirt is started. To disable this option, run virsh pool-autostart pool_name –disable.
virsh pool-info pool_name Displays information about the pool.
virsh vol-create-as pool_namevol_name size –format format_type Creates a volume. Specify the pool where the volume is located, the name of the volume, size of the image (in K, M, G, T), and the format of the volume.
virsh vol-list pool_name Lists the volumes in a pool. To include inactive volumes, add –details.
virsh vol-clone existing_vol_name new_vol_name –pool pool_name Copies and creates a volume in a storage pool.
virsh vol-delete –pool pool_name vol_name Deletes a volume from a storage pool.
virsh pool-destroy pool_name Stops a pool.
virsh pool-delete pool_name Deletes a pool directory from the host.
virsh pool-undefine pool_name Removes the pool definition.