Skip to content

Instantly share code, notes, and snippets.

@Filirom1
Last active December 23, 2015 08:05
Show Gist options
  • Save Filirom1/5804110 to your computer and use it in GitHub Desktop.
Save Filirom1/5804110 to your computer and use it in GitHub Desktop.
Add a node on OpenShift

Clone an existing Node. If you are using VMs it's quite easy.

Start the new Node (node5).

Then replace all references of the old hostname in /etc

grep -R node4 /etc 2>/dev/null
/etc/openshift.node.conf
/etc/sysconfig/network

The same thing for the IPs

grep -R $IP /etc 2>/dev/null
/etc/openshift.node.conf
/etc.sysconfig/network-scripts/ifcfg_ethX

And replace all references of the old MAC to the new one in /etc

grep -R $MAC /etc 2>/dev/null
/etc/udev/rules/d/70-persistent-net.rules
/etc.sysconfig/network-scripts/ifcfg_ethX

Reboot

First stop the running gears:

/etc/init.d/openshift-gears stop

Check network works

curl google.fr

Connect with ssh on your new node.

For OpenShift r3, get the oo-admin-gear script from github

curl https://github.com/openshift/origin-server/raw/master/node-util/sbin/oo-admin-gear > /root/oo-admin-gear
chmod u+x oo-admin-gear

Run the remove_all_gears.sh script on the node directly

Check /var/lib/openshift is empty

ls /var/lib/openshift/
last_access.log

Check iptables are clean

iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpts:35531:65535 state NEW
rhc-app-comm  all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:irdmi
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:pcsync-https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpts:35531:65535
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
rhc-app-comm  all  --  anywhere             anywhere

Chain rhc-app-comm (2 references)
target     prot opt source               destination

Check oo-accept node is clean

$ oo-accept-node
FAIL: /etc/openshift/node.conf: PUBLIC_HOSTNAME node5.apps.zone52.org does not resolve as a FQDN (getaddrinfo: Name or service not known)
1 ERRORS

Now connect with ssh on the broker

Add the domaine name node5.$CLOUD_DOMAIN in the BIND DNS server

/usr/sbin/oo-register-dns -h node5 -d $CLOUD_DOMAIN -n $IP

Check the new node is known by mcollective

mco find -Aopenshift

Add the node in the district

oo-admin-ctl-district -c add-node -n medium_district -p medium -i node5.$CLOUD_DOMAIN

Create an application on this node. Check the port 80 8000 443 and 8443 works. If not, update your firewall rules.

GEAR_DIR=/var/lib/openshift/
for UUID in `ls $GEAR_DIR`; do
if [ ! -d "$GEAR_DIR/$UUID" ]; then
continue
fi
FQDN=`cat $GEAR_DIR/$UUID/.env/OPENSHIFT_APP_DNS`
/root/oo-admin-gear destroygear -c $UUID -t --fqdn $FQDN
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment