@@ -116,6 +116,42 @@ else
116116fi
117117
118118# Start RKE2
119+ # Check RKE2 start first time or after reboot
120+ IPCHECK=" /var/lib/rancher/ip.log"
121+ if [ -f " $IPCHECK " ]; then
122+ # Check if the IP address changes, if changes print the banner
123+ host_prev_ip=$( cat " $IPCHECK " )
124+
125+ # Get the system ip
126+ pub_inerface_name=$( route | grep ' ^default' | grep -o ' [^ ]*$' )
127+ host_ip=$( ifconfig " ${pub_inerface_name} " | grep ' inet ' | awk ' {print $2}' )
128+
129+ if [[ " $host_ip " != " $host_prev_ip " ]]; then
130+ echo " IP changed"
131+ CHANGE_MSG=" Warning: The Edge Node IP(" $host_ip " ) has changed since RKE2 install!"
132+ banner="
133+ ================================================================================
134+ Edge Microvisor Toolkit - cluster bring up problem
135+
136+ ****Looks the IP address of the system chnaged since RKE2 install*****
137+
138+ OLD RKE2 cluster IP " $host_prev_ip "
139+ NEW RKE2 cluster IP " $host_ip "
140+
141+ IP address of the Node:
142+ " $host_prev_ip " - Ensure IP address is persistent across the reboot!
143+ See: https://ranchermanager.docs.rancher.com/getting-started
144+ /installation-and-upgrade/installation-requirements#node-ip-
145+ addresses $CHANGE_MSG
146+
147+ =================================================================================
148+ "
149+ # Print the banner
150+ echo " $banner " | sudo tee /dev/tty0
151+ else
152+ CHANGE_MSG=" IP address remained same after reboot."
153+ fi
154+ fi
119155echo " $( date) : Starting RKE2 4/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
120156sudo systemctl enable --now rke2-server.service
121157
@@ -201,23 +237,13 @@ export KUBECONFIG
201237echo " $( date) : The cluster installation is complete 13/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
202238echo " $( date) : The cluster installation is complete!"
203239
204- # Print banner
205240IP=$( sudo -E KUBECONFIG=/etc/rancher/rke2/rke2.yaml /var/lib/rancher/rke2/bin/kubectl get nodes -o jsonpath=' {range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address}{"\n"}{end}' )
206241IPCHECK=" /var/lib/rancher/ip.log"
207- CHANGE_MSG=" "
208242
209243if [ ! -f " $IPCHECK " ]; then
210244 echo " $IP " | sudo tee " $IPCHECK "
211- else
212- CLUSTER_IP=$( cat " $IPCHECK " )
213- if ip addr | grep -qw " $CLUSTER_IP " ; then
214- echo " IP address $CLUSTER_IP is present."
215- CHANGE_MSG=" IP address remained same after reboot."
216- else
217- echo " IP changed"
218- CHANGE_MSG=" Warning: The Edge Node IP has changed since RKE2 install!"
219- fi
220245fi
246+ # Print banner
221247
222248banner="
223249===================================================================
0 commit comments