Skip to content

Openshift Installation (Tested on GCE)

Chakradhar Rao Jonagam edited this page Jul 4, 2016 · 49 revisions

This is a single node installation for openshift origin Assuming prod.i63.io is your server , ssh to prod.i63.io

Install Dependencies and compile origin code

cd /usr/src/
yum install -y git
git clone https://github.com/openshift/origin.git
yum install -y go
cd origin/
make clean build
cd _output/local/bin/linux/amd64

Install Docker

rpm --import "https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e"
yum install -y yum-utils
yum-config-manager --add-repo https://packages.docker.com/1.9/yum/repo/main/centos/7
yum install -y docker-engine
systemctl restart docker

Alertnate key server pgp.mit.edu

Prepare executables

chmod +x oadm

Generate master and node configurations

./openshift start   --public-master='https://prod.i63.io:8443' \
--master='https://prod.i63.io:8443' --cors-allowed-origins=['prod.i63.io'] \
--write-config=/openshift.local.config

Set subdomain so requests can be accepted on *.prod.i63.io

vi /openshift.local.config/master/master-config.yaml
routingConfig:
  subdomain: prod.i63.io

Start master and node services on prod.i63.io

./openshift start  --master-config=/openshift.local.config/master/master-config.yaml \
--node-config=/openshift.local.config/node-prod-i63-io/node-config.yaml

Just for node in container mode (you can skip this)

docker run --privileged --pid=host --net=host  -vvar/run:/var/run:rw -v /sys:/sys -v /var/lib/docker:/var/lib/docker:rw -v /:/rootfs:ro  -v /var/lib/origin:/var/lib/origin  --rm openshift/origin:latest start node --config=/var/lib/origin/openshift.local.config/node-dir/node-config.yaml

create router service account and create router

./oc edit scc privileged --config=/openshift.local.config/master/admin.kubeconfig

users:
- system:serviceaccount:openshift-infra:build-controller
- system:serviceaccount:default:router
- system:serviceaccount:default:registry

Add "system:serviceaccount:default:router" and registry as shown above

echo     '{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"name":"router"}}' \
| ./oc create -n default --config=/openshift.local.config/master/admin.kubeconfig -f -
./oadm router default --replicas=1 \
    --credentials='/openshift.local.config/master/openshift-router.kubeconfig' \
    --service-account=router --config=/openshift.local.config/master/admin.kubeconfig

In command above "default" is the project name, if you want router on a different project then replace router , this is a hack as of now, there might be more clean method

Enable registry

./oadm registry --replicas=1 --credentials=/openshift.local.config/master/openshift-router.kubeconfig --config=/openshift.local.config/master/admin.kubeconfig

or ./oadm registry --service-account=router --config=/openshift.local.config/master/admin.kubeconfig

Restart openshift if needed at this point

Configure image streams

cd /usr/src
git clone https://github.com/openshift/openshift-ansible
export IMAGESTREAMDIR="/usr/src/openshift-ansible/roles/openshift_examples/files/examples/v1.1/image-streams"; 
export DBTEMPLATES="/usr/src/openshift-ansible/roles/openshift_examples/files/examples/v1.1/db-templates"; 
export QSTEMPLATES="/usr/src/openshift-ansible/roles/openshift_examples/files/examples/v1.1/quickstart-templates"

cd /usr/src/origin/_output/local/bin/linux/amd64

./oc create -f $IMAGESTREAMDIR/image-streams-rhel7.json -n openshift --config=/openshift.local.config/master/admin.kubeconfig

./oc create -f $DBTEMPLATES -n openshift --config=/openshift.local.config/master/admin.kubeconfig

Add insecure registry

systemctl status docker

Above command shows docker config file edit docker config file and add insecure registry as follows

vi /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/docker daemon --insecure-registry=0.0.0.0/0 -H fd://

systemctl daemon-reload
systemctl restart docker

Other Notes

Deleting registry

./oc delete svc/docker-registry --config=/openshift.local.config/master/admin.kubeconfig

Adding disk in GCE
[root@prod-i63-io g9chakri]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0  10G  0 disk 
└─sda1   8:1    0  10G  0 part /
sdb      8:16   0  30G  0 disk /mnt/d1
mkdir /mnt/d1
/usr/share/google/safe_format_and_mount /dev/sdb /mnt/d1

Configure slave

copy /openshift.local.config to slave change node-i63io-master/node-config.yaml
nodeIP: "192.168.0.7" nodeName: i63io-slave1 check node-i63io-master/node.kubeconfig and make master resolvable

Clone this wiki locally