OpenShift 4 New URL for Console and Monitoring WEB UI

about this Article

Tutorial.

Console URL

TLS

# mkdir ~/TLS && cd ~/TLS/
# export DOMAIN="example.local"
# export SHORT_NAME="console"
# cat > ${SHORT_NAME}_answer.txt << EOF[req]
default_bits = 4096
prompt = no
default_md = sha256
x509_extensions = req_ext
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=US
ST=New York
L=New York
O=MyOrg
OU=MyOrgUnit
emailAddress=me@working.me
CN = ${SHORT_NAME}
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = ${SHORT_NAME}
DNS.2 = ${SHORT_NAME}.${DOMAIN}
EOF
# openssl genrsa -out ${SHORT_NAME}.key 4096

Generate Server CSR

$ openssl req -new -key ${SHORT_NAME}.key -out ${SHORT_NAME}.csr -config <( cat ${SHORT_NAME}_answer.txt )
$ openssl req -in ${SHORT_NAME}.csr -noout -text | grep DNS
              DNS:console, DNS:console.example.local

Testing the Certificate

$ openssl x509 -in tls.crt -noout -text | grep DNS
DNS:registry, DNS:registry.example.local
$ openssl verify -CAfile ca.crt tls.crt
tls.crt: OK

secret

# oc create secret tls console-tls --cert=~/TLS/tls.crt --key=~/TLS/tls.key -n openshift-config

new URL

# cat > ingress-console.yaml << EOF
apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
name: cluster
spec:
componentRoutes:
- name: console
namespace: openshift-console
hostname: ${SHORT_NAME}.${DOMAIN}
servingCertKeyPairSecret:
name: console-tls
EOF
# oc apply -f ingress-console.yaml

Monitoring URL

# oc create secret tls grafana-tls --cert=~/TLS/tls.crt --key=~/TLS/tls.key -n openshift-monitoring 
# oc create route new-grafana reencrypt --service=grafana --cert=./tls.crt --key=./tls.key --insecure-policy=Redirect --hostname=grafana.example.com
# oc get sa grafana -n openshift-monitoring -o jsonpath='{.metadata.annotations}'
{
"serviceaccounts.openshift.io/oauth-redirectreference.grafana": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"grafana\"}}"
}
# oc edit sa grafana -n openshift-monitoring
{
"serviceaccounts.openshift.io/oauth-redirectreference.grafana": "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"new-grafana\"}}"
}

--

--

Open Source contributer for the past 15 years

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store