Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Redirect all url to another cluster openshift

ezepsuarez
Nimbostratus
Nimbostratus

Currently we have 2 clusters, 1 active and 1 passive, and we configure a url for the user to enter without having to change anything and in case of having to redirect the traffic, it is transparent for the user.


This is our configuration.

Users enter through this url
https://grafana-openshift-monitoring.apps.cluster.company.com/

and then with F5 it should be redirected to the cluster that is active and these 2 can be

https://grafana-openshift-monitoring.apps.cluster1.company.com/
https://grafana-openshift-monitoring.apps.cluster2.company.com/

The idea is that you don't have to rewrite each url, but instead set up an irule that replaces the cluster name within the url and then redirects it.

Any idea how to do it?

1 REPLY 1

Hi ezepsuarez,

Can you try the below iRule, after changed the pool name, members IP addresses, and ports?

when HTTP_REQUEST {
	if { [LB::status pool grafana_pool member 10.11.12.101 443] eq "up" } {
		HTTP::host "grafana-openshift-monitoring.apps.cluster1.company.com"
		pool grafana_pool member 10.11.12.101 443
	}
	elseif { [LB::status pool grafana_pool member 10.11.12.102 443] eq "up" } {
		HTTP::host "grafana-openshift-monitoring.apps.cluster2.company.com"
		pool grafana_pool member 10.11.12.102 443
	}
	else {
		HTTP::respond 200 content "Server unavailable"
	}
}