Undoubtedly, route have a key role to accessing your pods and their applications inside.
You may want to learn your whole Kubernetes or Openshift routes and their hostnames. Also you want to learn reachability of them. Here comes a shortcut!
First step is creating a variable :
hosts=$(oc get route -A \ -o jsonpath='{.items[*].spec.host}')
You can ensure that just getting the hostnames, rather than any other info by running :
echo $hosts
After this point we need a series of shell command to get names and HTTP status of our routes. For this task, write out the codes shown below :
for host in $hosts ; do \ curl https://$host -k -w "%{url_effective} %{http_code}\n" -o /dev/null -s ; \ done https://oauth-openshift.apps.ocp4.ozgurkkisa.com/ 403 https://console-openshift-console.apps.ocp4.ozgurkkisa.com/ 200As you see above, you are viewing the hostnames, url's and HTTP service status of all routes.
https://downloads-openshift-console.apps.ocp4.ozgurkkisa.com/ 200
https://alertmanager-main-openshift-monitoring.apps.ocp4.ozgurkkisa.com/ 403
https://grafana-openshift-monitoring.apps.ocp4.ozgurkkisa.com/ 403
https://prometheus-k8s-openshift-monitoring.apps.ocp4.ozgurkkisa.com/ 403
https://thanos-querier-openshift-monitoring.apps.ocp4.ozgurkkisa.com/ 403
Alternatively you can save this code as a shell script file (.sh) and run whenever you want.
Note: I use the / character to code visibility and easy reading. You can remove the "/" and run individual commands successive.
Hope this helps! Have a nice day :)
Comments
Post a Comment