Chapter 1. Installing Developer Hub on Google Kubernetes Engine (GKE) by using the Operator
To benefit from over-the-air updates and catalogs provided by Operator-based applications distributed with the Operator Lifecycle Manager (OLM) framework, consider installing Red Hat Developer Hub by using the Red Hat Developer Hub Operator distributed in the Red Hat Ecosystem.
On GKE, the most notable differences over an OpenShift-based installation are:
- The OLM framework and the Red Hat Ecosystem are not built-in.
- The Red Hat Ecosystem pull-secret is not managed globally.
- To expose the application, Ingresses replace OpenShift Routes.
For clarity, the content is broken down in sections highlighting these platform-specific additional steps.
1.1. Installing the Developer Hub Operator on Google Kubernetes Engine (GKE) by using the OLM framework Copy linkLink copied to clipboard!
The Red Hat Ecosystem, based on the Operator Lifecycle Manager (OLM) framework, contains a distribution of the Red Hat Developer Hub Operator, aimed at managing your Red Hat Developer Hub instance lifecycle.
However, on Google Kubernetes Engine (GKE):
- The Operator Lifecycle Manager (OLM) framework and the Red Hat Ecosystem are not built-in.
- The Red Hat Ecosystem pull-secret is not managed globally.
Therefore, install the OLM framework, the Red Hat Ecosystem, and provision your Red Hat Ecosystem pull secret to install Developer Hub Operator.
Prerequisites
-
You have installed the
kubectlCLI on your local environment. - Your system meets the sizing requirements for Red Hat Developer Hub.
- You have installed the Operator Lifecycle Manager (OLM).
Your credentials to the Red Hat Container Registry:
- <redhat_user_name>
- <redhat_password>
- <email>
- You have logged in to your Google account and created a GKE Autopilot or GKE Standard cluster.
Procedure
Connect to your GKE cluster:
gcloud container clusters get-credentials <cluster-name> --location=<cluster-location>
$ gcloud container clusters get-credentials <cluster-name> --location=<cluster-location>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - <cluster-name>
- Enter your GKE cluster name.
- <cluster-location>
- Enter your GKE cluster location.
Create the
rhdh-operatornamespace to contain the Red Hat Developer Hub Operator:kubectl create namespace rhdh-operator
$ kubectl create namespace rhdh-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a pull secret using your Red Hat credentials to pull the container images from the protected Red Hat Ecosystem:
kubectl -n rhdh-operator create secret docker-registry rhdh-pull-secret \ --docker-server=registry.redhat.io \ --docker-username=<redhat_user_name> \ --docker-password=<redhat_password> \ --docker-email=<email>$ kubectl -n rhdh-operator create secret docker-registry rhdh-pull-secret \ --docker-server=registry.redhat.io \ --docker-username=<redhat_user_name> \ --docker-password=<redhat_password> \ --docker-email=<email>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a catalog source that contains the Red Hat Ecosystem Operators:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an operator group to manage your operator subscriptions:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a subscription to install the Red Hat Developer Hub Operator:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To wait until the Operator deployment finishes to be able to run the next step, run:
until kubectl -n rhdh-operator get deployment rhdh-operator &>/dev/null; do echo -n . sleep 3 done echo "RHDH Operator Deployment created"
until kubectl -n rhdh-operator get deployment rhdh-operator &>/dev/null; do echo -n . sleep 3 done echo "RHDH Operator Deployment created"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Include your pull secret name in the Operator deployment manifest, to avoid
ImagePullBackOfferrors:kubectl -n rhdh-operator patch deployment \ rhdh-operator --patch '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"rhdh-pull-secret"}]}}}}' \ --type=merge$ kubectl -n rhdh-operator patch deployment \ rhdh-operator --patch '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"rhdh-pull-secret"}]}}}}' \ --type=mergeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the deployment name:
kubectl get deployment -n rhdh-operator
$ kubectl get deployment -n rhdh-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2. Provisioning your custom Red Hat Developer Hub configuration Copy linkLink copied to clipboard!
To configure Red Hat Developer Hub, provision your custom Red Hat Developer Hub config maps and secrets to Google Kubernetes Engine (GKE) before running Red Hat Developer Hub.
On Red Hat OpenShift Container Platform, you can skip this step to run Developer Hub with the default config map and secret. Your changes on this configuration might get reverted on Developer Hub restart.
Prerequisites
- By using the Kubernetes CLI ('kubectl'), you have access, with developer permissions, to the Kubernetes cluster aimed at containing your Developer Hub instance.
Procedure
Author your custom
<my_product_secrets>.txtfile to provision your secrets as environment variables values in a Kubernetes secret, rather than in clear text in your configuration files. It contains one secret per line inKEY=valueform.Author your custom
app-config.yamlfile. This is the main Developer Hub configuration file. You need a customapp-config.yamlfile to avoid the Developer Hub installer to revert user edits during upgrades. When your customapp-config.yamlfile is empty, Developer Hub is using default values.- To prepare a deployment with the Red Hat Developer Hub Operator on GKE, you can start with an empty file.
To prepare a deployment with the Red Hat Developer Hub Helm chart, or on Kubernetes, enter the Developer Hub base URL in the relevant fields in your
app-config.yamlfile to ensure proper functionality of Developer Hub. The base URL is what a Developer Hub user sees in their browser when accessing Developer Hub. The relevant fields arebaseUrlin theappandbackendsections, andoriginin thebackend.corssubsection:Example 1.1. Configuring the
baseUrlinapp-config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optionally, enter your configuration such as:
Provision your custom configuration files to your GKE cluster.
Create the <my-rhdh-project> {namespace} aimed at containing your Developer Hub instance.
oc create namespace my-rhdh-project
$ oc create namespace my-rhdh-projectCopy to Clipboard Copied! Toggle word wrap Toggle overflow Provision your
app-config.yamlfile to themy-rhdh-app-configconfig map in the <my-rhdh-project> project.oc create configmap my-rhdh-app-config --from-file=app-config.yaml --namespace=my-rhdh-project
$ oc create configmap my-rhdh-app-config --from-file=app-config.yaml --namespace=my-rhdh-projectCopy to Clipboard Copied! Toggle word wrap Toggle overflow Provision your
<my_product_secrets>.txtfile to the<my_product_secrets>secret in the <my-rhdh-project> project.oc create secret generic <my_product_secrets> --from-file=<my_product_secrets>.txt --namespace=my-rhdh-project
$ oc create secret generic <my_product_secrets> --from-file=<my_product_secrets>.txt --namespace=my-rhdh-projectCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
- To use an external PostgreSQL database, provision your PostgreSQL database secrets.
- To enable dynamic plugins, provision your dynamic plugins config map.
- To configure authorization by using external files, provision your RBAC policies config map.
1.3. Provision your Red Hat Ecosystem pull secret to your Red Hat Developer Hub instance namespace Copy linkLink copied to clipboard!
On Google Kubernetes Engine (GKE), the Red Hat Ecosystem pull-secret is not managed globally. Therefore add your pull-secret in your Red Hat Developer Hub instance namespace.
Prerequisites
Your credentials to the Red Hat Container Registry:
- <redhat_user_name>
- <redhat_password>
- <email>
-
You created the
{my-rhdh-project}namespace on GKE to host your Developer Hub instance.
Procedure
Create a pull secret using your Red Hat credentials to pull the container images from the protected Red Hat Ecosystem:
kubectl -n {my-rhdh-namespace} create secret docker-registry my-rhdh-pull-secret \ --docker-server=registry.redhat.io \ --docker-username=<redhat_user_name> \ --docker-password=<redhat_password> \ --docker-email=<email>$ kubectl -n {my-rhdh-namespace} create secret docker-registry my-rhdh-pull-secret \ --docker-server=registry.redhat.io \ --docker-username=<redhat_user_name> \ --docker-password=<redhat_password> \ --docker-email=<email>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To enable pulling Developer Hub images from the Red Hat Ecosystem Catalog, add the image pull secret in the default service account within the namespace where the Developer Hub instance is being deployed:
kubectl patch serviceaccount default \ -p '{"imagePullSecrets": [{"name": "my-rhdh-pull-secret"}]}' \ -n {my-rhdh-namespace}$ kubectl patch serviceaccount default \ -p '{"imagePullSecrets": [{"name": "my-rhdh-pull-secret"}]}' \ -n {my-rhdh-namespace}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4. Using the Red Hat Developer Hub Operator to run Developer Hub with your custom configuration Copy linkLink copied to clipboard!
To use the Developer Hub Operator to run Red Hat Developer Hub with your custom configuration, create your Backstage custom resource (CR) that:
- Mounts files provisioned in your custom config maps.
- Injects environment variables provisioned in your custom secrets.
Prerequisites
- By using the Kubernetes CLI ('kubectl'), you have access, with developer permissions, to the GKE cluster aimed at containing your Developer Hub instance.
- Your administrator has installed the Red Hat Developer Hub Operator in the cluster.
-
You have provisioned your custom config maps and secrets in your
<my-rhdh-project>project.
Procedure
Author your Backstage CR in a
my-rhdh-custom-resource.yamlfile to use your custom config maps and secrets.Minimal
my-rhdh-custom-resource.yamlcustom resource example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow my-rhdh-custom-resource.yamlcustom resource example with dynamic plugins and RBAC policies config maps, and external PostgreSQL database secrets:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Mandatory fields
- No fields are mandatory. You can create an empty Backstage CR and run Developer Hub with the default configuration.
- Optional fields
spec.application.appConfig.configMaps- Enter your config map name list.
Mount files in the
my-rhdh-app-configconfig map:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Mount files in the
my-rhdh-app-configandrbac-policiesconfig maps:Copy to Clipboard Copied! Toggle word wrap Toggle overflow spec.application.extraEnvs.envsOptionally, enter your additional environment variables that are not secrets, such as your proxy environment variables.
Inject your
HTTP_PROXY,HTTPS_PROXYandNO_PROXYenvironment variables:Copy to Clipboard Copied! Toggle word wrap Toggle overflow spec.application.extraEnvs.secretsEnter your environment variables secret name list.
Inject the environment variables in your Red Hat Developer Hub secret:
spec: application: extraEnvs: secrets: - name: <my_product_secrets>spec: application: extraEnvs: secrets: - name: <my_product_secrets>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inject the environment variables in the Red Hat Developer Hub and
my-rhdh-database-secretssecrets:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note<my_product_secrets>is your preferred Developer Hub secret name, specifying the identifier for your secret configuration within Developer Hub.spec.application.extraFiles.secretsEnter your certificates files secret name and files list.
Mount the
postgres-crt.pem,postgres-ca.pem, andpostgres-key.keyfiles contained in themy-rhdh-database-certificates-secretssecret:Copy to Clipboard Copied! Toggle word wrap Toggle overflow spec.database.enableLocalDbEnable or disable the local PostgreSQL database.
Disable the local PostgreSQL database generation to use an external postgreSQL database:
spec: database: enableLocalDb: falsespec: database: enableLocalDb: falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow On a development environment, use the local PostgreSQL database:
spec: database: enableLocalDb: truespec: database: enableLocalDb: trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow spec.deployment- Optionally, enter your deployment configuration.
Apply your Backstage CR to start or update your Developer Hub instance:
oc apply --filename=my-rhdh-custom-resource.yaml --namespace=my-rhdh-project
$ oc apply --filename=my-rhdh-custom-resource.yaml --namespace=my-rhdh-projectCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.5. Exposing your operator-based Red Hat Developer Hub instance on Google Kubernetes Engine (GKE) Copy linkLink copied to clipboard!
On Google Kubernetes Engine (GKE), to expose your Red Hat Developer Hub instance, Kubernetes ingresses replace OpenShift Container Platform routes. The Red Hat Developer Hub operator does not create ingresses. Therefore, to access your Developer Hub instance via a domain name, create the required ingresses on GKE and point your domain name to it.
Prerequisites
- You have installed Red Hat Developer Hub by using the Red Hat Developer Hub Operator.
- You have configured a domain name for your Developer Hub instance.
- You have reserved a static external Premium IPv4 Global IP address that is not attached to any virtual machine (VM). For more information see Reserve a new static external IP address
You have configured the DNS records for your domain name to point to the IP address that has been reserved.
NoteYou need to create an
Arecord with the value equal to the IP address. This process can take up to one hour to propagate.
Procedure
Create a Google-managed certificate manifest file, named
managed-certificate.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about setting up a Google-managed certificate, see Setting up a Google-managed certificate.
Deploy the managed certificate:
kubectl -n my-rhdh-project apply -f managed-certificate.yaml
$ kubectl -n my-rhdh-project apply -f managed-certificate.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a frontend config manifest file, named
frontend-config.yaml, to set a policy for redirecting to HTTPS.Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about setting a policy to redirect to HTTPS, see HTTP to HTTPS redirects.
Deploy the frontend config:
kubectl -n my-rhdh-project apply -f frontend-config.yaml
$ kubectl -n my-rhdh-project apply -f frontend-config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create an ingress manifest file, named
rhdh-ingress.yaml, specifying your Developer Hub service name, and using your managed certificate and your frontend config:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the ingress:
kubectl -n my-rhdh-project apply -f rhdh-ingress.yaml
$ kubectl -n my-rhdh-project apply -f rhdh-ingress.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
Wait for the
ManagedCertificateto be provisioned. This process can take a couple of hours. -
Access RHDH with
https://<my_developer_hub_domain>.
Additional information
For more information on setting up GKE using Ingress with TLS, see Secure GKE Ingress.