Openshift on VPS like Scaleways with Hostname(Updated 5/2/18)

James Drummond PE
Sep 19, 2017 · 4 min read
#Run on Linux OpenShift Origin master node/machine
export EXTERNAL_IP=$(curl ipinfo.io/ip )
#Copy to clipboard
export EXTERNAL_IP_HOST_RESOLVE="$EXTERNAL_IP devcomb.com"
echo ${EXTERNAL_IP_HOST_RESOLVE} >> /etc/hosts
#Local Browser Machine - Windows 10
#Change %USERNAME% to admin username
#You can also right click notepad and do run as user then open file.
runas /env /user:%USERDOMAIN%\%USERNAME% "notepad %SYSTEMROOT%\System32\Drivers\etc\hosts"
#Local Browser Machine - Linux
echo "<Paste EXTERNAL_IP_HOST_RESOLVE>" >> /etc/hosts
# Install docker if you don't have it already.yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engineyum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repodocker install -y docker-cesed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --insecure-registry 172.30.0.0/16 --exec-opt native.cgroupdriver=systemd|" \
/usr/lib/systemd/system/docker.service
systemctl daemon-reload
systemctl restart docker
# Download the latest OpenShift Origin binaries from https://github.com/openshift/origin/releases currently 3.9.0. Extract files and copy file to folder included in PATH environment variable such as /usr/bin directory.export OPENSHIFT_VERSION=3.9.0-191fece
export OPENSHIFT_VERSION_BASE=3.9.0
wget https://github.com/openshift/origin/releases/download/v${OPENSHIFT_VERSION_BASE}/openshift-origin-server-v${OPENSHIFT_VERSION}-linux-64bit.tar.gz
tar -xzf openshift-origin-server-v${OPENSHIFT_VERSION}-linux-64bit.tar.gz
rm -f openshift-origin-server-v${OPENSHIFT_VERSION}-linux-64bit/LICENSE openshift-origin-server-v${OPENSHIFT_VERSION}-linux-64bit/README.md
cp openshift-origin-server-v${OPENSHIFT_VERSION}-linux-64bit/* /usr/bin/
#Only needed if OpenShift is already running
#from ipaddress article mentioned before
oc cluster down
mkdir /var/lib/origin
cd /var/lib/origin/
hostname devcomb.com
#Updated 02/28/2018
openshift start master --master="https://$(hostname):8443" \
--dns="https://0.0.0.0:8053" \
--write-config="/var/lib/origin/openshift.local.config/master"
export OPENSHIFT_HOSTNAMES=kubernetes.default.svc.cluster.local,localhost,openshift.default.svc.cluster.local,127.0.0.1,172.17.0.1,172.18.0.1,172.19.0.1,172.30.0.1,192.168.122.1,192.168.42.1,$(hostname)
oc adm create-node-config \
--node-dir=/var/lib/origin/openshift.local.config/node-localhost \
--node=localhost --hostnames=$OPENSHIFT_HOSTNAMES --master="https://$(hostname):8443" --dns-ip='172.30.0.1'
sed -i "s/router.default.svc.cluster.local/$(hostname)/" \
openshift.local.config/master/master-config.yaml
#Authentication mention at the end of article can be done before
#starting the cluster with the following.
rm -Rf ~/.kube
oc cluster up --use-existing-config --public-hostname=$(hostname)
yum install -y httpd-tools
htpasswd -c /var/lib/origin/openshift.local.config/master/users.htpasswd developer
perl -0777 -i.original -pe 's|- challenge: true\n    login: true\n    mappingMethod: claim\n    name: anypassword\n    provider:\n      apiVersion: v1\n      kind: AllowAllPasswordIdentityProvider|- name: my_htpasswd_provider\n    challenge: true\n    login: true\n    mappingMethod: add\n    provider:\n      apiVersion: v1\n      kind: HTPasswdPasswordIdentityProvider\n      file: /var/lib/origin/openshift.local.config/master/users.htpasswd|igs' /var/lib/origin/openshift.local.config/master/master-config.yaml#Updated 1/4/18
perl -0777 -i.original -pe 's|accessTokenMaxAgeSeconds: 86400|accessTokenMaxAgeSeconds: 8640000|igs' /var/lib/origin/openshift.local.config/master/master-config.yaml

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade