客製化openshift console URL

官方文件官方知識庫都有提到如何修改,因為沒有太多上下文,第一次看完後有點摸不著頭緒,最後找到Customizing the OpenShift Console URL with TLS並按照這一篇文章設定成功

從參考資料看起來要從預設的console-openshift-console.apps.foo.bar.com改為以下兩種形式都可以,目前只有試過第一種成功,第二種還需要客製化憑證,需要找時間再試試

  1. 類似base domain的my-customized.apps.foo.bar.commy-customized.bar.com
  2. 不同base domain的my-customized.other.com

Openshift Ingress Configuration in Cluster Settings

剛開始看到ingress.config.openshift.io,不太確定是屬於哪一種資料(Pod, Deployment, Service),最後是在Cluster Settings找到,看起來是專屬於openshift的設定資料,在spec加上componentRoutes,儲存後就會生效

Cluster Settings

1
oc edit ingress.config.openshift.io cluster
1
2
3
4
5
6
7
8
9
10
11
12
13
apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
creationTimestamp: "2025-01-09T08:13:27Z"
generation: 8
name: cluster
resourceVersion: "2859957"
uid: 662c61fb-000a-4185-90f6-534c09cdf05f
spec:
componentRoutes:
- hostname: my-customized.apps.foo.bar.com
name: console
namespace: openshift-console

可以使用以下指令檢查,成功的話會多出一筆console-custom且原本的console-openshift-console.apps.foo.bar.com還是可以存取

1
oc get route -n openshift-console
1
2
3
4
NAME             HOST/PORT                                             PATH   SERVICES    PORT    TERMINATION          WILDCARD
console console-openshift-console.apps.foo.bar.com console https reencrypt/Redirect None
console-custom my-customized.apps.foo.bar.com console https reencrypt/Redirect None
downloads downloads-openshift-console.apps.foo.bar.com downloads http edge/Redirect None

Optional: 客製化的URL不在apps.foo.bar.com的subdomain

需要在DNS加上一筆record,指向Ingress VIP

1
my-customized.bar.com <Ingress VIP>