Skip to content

Instantly share code, notes, and snippets.

@jovemfelix
Created March 15, 2024 19:56
Show Gist options
  • Save jovemfelix/649a169fc2611fd4bbc59ba3ea87ba06 to your computer and use it in GitHub Desktop.
Save jovemfelix/649a169fc2611fd4bbc59ba3ea87ba06 to your computer and use it in GitHub Desktop.
WILDCARD_DOMAIN=$(oc whoami --show-console 2> /dev/null | cut -d '.' -f2- | cut -d ':' -f1)
NAME_KEYCOAK=admin-rhbk
SECRET_NAME=keycloak-admin-tls-secret
openssl req -subj "/CN=${NAME_KEYCOAK}.${WILDCARD_DOMAIN}/O=Test RHBK./C=BR" -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
oc create secret tls ${SECRET_NAME} --cert certificate.pem --key key.pem
oc create route passthrough rhbk-dev-admin --service=rhbk-dev-service --port=https --hostname="${NAME_KEYCOAK}.${WILDCARD_DOMAIN}"
echo "created secret ${SECRET_NAME} for host: https://${NAME_KEYCOAK}.${WILDCARD_DOMAIN}"
# Reference: https://access.redhat.com/documentation/pt-br/red_hat_build_of_keycloak/22.0/html/server_guide/hostname-#hostname-administration-console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment