
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
An OpenShift route or an Ingress route will provide a URL such as http://my-route-my-project.apps.openshift.example.com which is used to route a request onto a service, which is then routed onto a pod, and then to the container in the pod, and finally to the application running in the container.
Like this.
The oc get ingress.config command can be used to list the ingress configs. By default, there should be a single ingress config named "cluster".
~]$ oc get ingresses.config
NAME AGE
cluster 376d
The oc describe ingresses.config command can be used to display the ingress domain name (aka the base "apps" URL). In this example, the ingress domain name is apps.openshift.example.com.
~]$ oc describe ingresses.config cluster
Name: cluster
Namespace:
Labels: <none>
Annotations: <none>
API Version: config.openshift.io/v1
Kind: Ingress
Metadata:
Creation Timestamp: 2021-07-16T17:10:11Z
Generation: 1
Managed Fields:
API Version: config.openshift.io/v1
Fields Type: FieldsV1
fieldsV1:
f:spec:
.:
f:domain:
f:status:
Manager: cluster-bootstrap
Operation: Update
Time: 2021-07-16T17:10:11Z
Resource Version: 551
Self Link: /apis/config.openshift.io/v1/ingresses/cluster
UID: 92d95b9d-b8c2-4109-a588-f1d9aed25a66
Spec:
Domain: apps.openshift.example.com
Status:
Events: <none>
Or, the oc get ingress.config command with the --output json or --output yaml option can be used.
~]$ oc get ingresses.config cluster --output json
{
"apiVersion": "config.openshift.io/v1",
"kind": "Ingress",
"metadata": {
"creationTimestamp": "2021-07-16T17:10:11Z",
"generation": 1,
"name": "cluster",
"resourceVersion": "551",
"uid": "92d95b9d-b8c2-4109-a588-f1d9aed25a66"
},
"spec": {
"domain": "apps.openshift.example.com"
},
"status": {}
}
The --output jsonpath option can be used to print the value of a specific JSON key.
~]$ oc get ingresses.config cluster --output jsonpath={.spec.domain}
apps.openshift.example.com
Did you find this article helpful?
If so, consider buying me a coffee over at