Skip to content

Setup Standalone

David Maier edited this page Mar 29, 2017 · 14 revisions

CentOS 7

I used a basic ISO installation of the standard DVD media.

  • Configure the network
nmtui
  • Disable the Firewall
systemctl disable firewalld
systemctl stop firewalld

Docker

  • Install Docker
yum install docker
  • Enable Docker daemon at startup
systemctl enable docker
systemctl start docker
  • Modify the Docker startup file (/etc/sysconfig/docker) in order to allow an insecure registry
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --insecure-registry 172.30.0.0/16'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

172.30.0.0/16 is used because the registry will get an IP in this range.

  • Restart the Docker daemon
systemctl daemon-reload
systemctl restart docker

OpenShift

  • Create the OpenShift installation directory
mkdir /opt/openshift-v1.4
chmod 755 /opt/openshift-v1.4/
  • Download OpenShift
wget https://github.com/openshift/origin/releases/download/v1.4.1/openshift-origin-server-v1.4.1-3f9807a-linux-64bit.tar.gz
  • Extract OpenShift
tar -zxvf openshift-origin-server-*.tar.gz --strip-components 1
rm openshift-origin-server-v1.4.1-3f9807a-linux-64bit.tar.gz
  • Create the file '/etc/profile.d/openshift.sh'
export OPENSHIFT=/opt/openshift-v1.4
export OPENSHIFT_VERSION=v1.4.1
export PATH=$OPENSHIFT:$PATH
export KUBECONFIG=$OPENSHIFT/openshift.local.config/master/admin.kubeconfig
export CURL_CA_BUNDLE=$OPENSHIFT/openshift.local.config/master/ca.crt
  • Load the file
chmod 755 /etc/profile.d/openshift.sh
. /etc/profile.d/openshift.sh
  • Pull images
docker pull openshift/origin-pod:$OPENSHIFT_VERSION
docker pull openshift/origin-sti-builder:$OPENSHIFT_VERSION
docker pull openshift/origin-docker-builder:$OPENSHIFT_VERSION
docker pull openshift/origin-deployer:$OPENSHIFT_VERSION
docker pull openshift/origin-docker-registry:$OPENSHIFT_VERSION
docker pull openshift/origin-haproxy-router:$OPENSHIFT_VERSION
  • Start OpenShift
 ./openshift start --write-config=openshift.local.config
  • Change permissions of the config files
chmod +r $OPENSHIFT/openshift.local.config/master/admin.kubeconfig
chmod +r $OPENSHIFT/openshift.local.config/master/openshift-registry.kubeconfig
chmod +r $OPENSHIFT/openshift.local.config/master/openshift-router.kubeconfig
  • Start OpenShift
cd /opt/openshift-v1.4
nohup ./openshift start &
  • Login to OpenShift
oc login -u system:admin -n default
  • Add admin to the required roles
oadm policy add-cluster-role-to-user cluster-admin admin
  • Create a private registry
mkdir /opt/openshift-registry
chcon -Rt svirt_sandbox_file_t /opt/openshift-registry
chown 1001.root /opt/openshift-registry
oadm policy add-scc-to-user privileged -z registry
oadm registry --service-account=registry --mount-host=/opt/openshift-registry
oc get svc docker-registry
  • Add router
oadm policy add-scc-to-user hostnetwork -z router
oadm router router --replicas=1 --service-account=router
  • Install default image streams
yum install git

cd --
mkdir Github
cd Github/
git clone https://github.com/openshift/openshift-ansible.git
cd openshift-ansible/roles/openshift_examples/files/examples/latest/
for f in image-streams/image-streams-centos7.json; do cat $f | oc create -n openshift -f -; done
for f in db-templates/*.json; do cat $f | oc create -n openshift -f -; done
for f in quickstart-templates/*.json; do cat $f | oc create -n openshift -f -; done

Test it

  • Login as admin/admin
https://192.168.178.201:8443/console

The following article helped a lot: http://sudhaker.com/10/install-the-latest-openshift-v3-on-centos-7-1

I had to add some security exceptions in my browser.

Couchbase Image

  • Download image 'couchbase:rhel-4.5.1'
mkdir $HOME/Download
cd $HOME/Download
curl -o os-cb.tar https://s3-eu-west-1.amazonaws.com/os-cb-image/os-cb-0.2.tar --insecure

Note: How is this built? Will it be everytime available from this location?

  • Load image to local Docker
docker load -i os-cb.tar
  • Find out the image id
docker images | grep 'rhel-4.5.1'

It should be '00e4d95aa26c'. Export the image id:

export IMAGE_ID=00e4d95aa26c
  • Find out the admin token
oc login -u admin -p admin
oc whoami -t
  • Note down the returned string and expose it as environment variable
export TOKEN=wlOca...
  • Get the IP of the Docker registry and export it as REGISTRY_IP
oc get svc | grep docker-registry
export REGISTRY_IP=172.30...
  • Auth user to be able to push
oc policy add-role-to-user admin admin -n openshift
  • Login to the docker registry
docker login -u admin -p "${TOKEN}" "${REGISTRY_IP}:5000"

You shoud see 'Login Succeeded'.

  • Load the image to the private registry
IMAGE_NAME="${REGISTRY_IP}:5000/openshift/couchbase-noroot:4.5.1-enterprise"
docker tag "$IMAGE_ID" "$IMAGE_NAME"
docker push "$IMAGE_NAME"

OpenShift customizations

TODO