$ oc edit apiserver.config.openshift.io cluster
By default, the cluster restricts api server requests to the web console for security. Because the default configuration only permits the web console, you must update the api Server configuration of the cluster to approve additional hostnames for api and OAuth access.
If you need to access the api server or OAuth server from a JavaScript application by using a different hostname, you can configure additional hostnames to allow.
Access to the cluster as a user with the cluster-admin role.
Edit the apiServer resource:
$ oc edit apiserver.config.openshift.io cluster
Add the additionalCORSAllowedOrigins field under the spec section and specify one or more additional hostnames:
apiVersion: config.openshift.io/v1
kind: apiServer
metadata:
annotations:
release.openshift.io/create-only: "true"
creationTimestamp: "2019-07-11T17:35:37Z"
generation: 1
name: cluster
resourceVersion: "907"
selfLink: /apis/config.openshift.io/v1/apiservers/cluster
uid: 4b45a8dd-a402-11e9-91ec-0219944e0696
spec:
additionalCORSAllowedOrigins:
- (?i)//my\.subdomain\.domain\.com(:|\z)
where:
additionalCORSAllowedOriginsThe hostname is specified as a Golang regular expression that matches against CORS headers from HTTP requests against the api server and OAuth server.
|
This example uses the following syntax:
|
Save the file to apply the changes.