|
| 1 | +[id="proc-deploy-rhdh-instance-gke.adoc_{context}"] |
| 2 | += Deploying the {product-short} instance on {gke-short} with the Operator |
| 3 | +You can deploy your {product-short} instance in {gke-short} using the Operator. |
| 4 | + |
| 5 | +.Prerequisites |
| 6 | +* A cluster administrator has installed the {product} Operator. |
| 7 | +* You have subscribed to `registry.redhat.io`. For more information, see https://access.redhat.com/RegistryAuthentication[{company-name} Container Registry Authentication]. |
| 8 | +* You have installed `kubectl`. For more information, see https://kubernetes.io/docs/tasks/tools/#kubectl[Install kubetl]. |
| 9 | + |
| 10 | +* You have configured a domain name for your {product-short} instance. |
| 11 | +* You have reserved a static external Premium IPv4 Global IP address that is not attached to any virtual machine (VM). For more information see https://cloud.google.com/vpc/docs/reserve-static-external-ip-address#reserve_new_static[Reserve a new static external IP address] |
| 12 | +* You have configured the DNS records for your domain name to point to the IP address that has been reserved. |
| 13 | ++ |
| 14 | +[NOTE] |
| 15 | +==== |
| 16 | +You need to create an `A` record with the value equal to the IP address. This process can take up to one hour to propagate. |
| 17 | +==== |
| 18 | + |
| 19 | +.Procedure |
| 20 | +. Create a ConfigMap named `app-config-rhdh` containing the {product-short} configuration using the following template: |
| 21 | ++ |
| 22 | +-- |
| 23 | +.`app-config-rhdh.yaml` fragment |
| 24 | +[source,yaml,subs="attributes+"] |
| 25 | +---- |
| 26 | +apiVersion: v1 |
| 27 | +kind: ConfigMap |
| 28 | +metadata: |
| 29 | + name: app-config-rhdh |
| 30 | +data: |
| 31 | + "app-config-rhdh.yaml": | |
| 32 | + app: |
| 33 | + title: Red Hat Developer Hub |
| 34 | + baseUrl: https://<rhdh_domain_name> |
| 35 | + backend: |
| 36 | + auth: |
| 37 | + externalAccess: |
| 38 | + - type: legacy |
| 39 | + options: |
| 40 | + subject: legacy-default-config |
| 41 | + secret: "${BACKEND_SECRET}" |
| 42 | + baseUrl: https://<rhdh_domain_name> |
| 43 | + cors: |
| 44 | + origin: https://<rhdh_domain_name> |
| 45 | +---- |
| 46 | +-- |
| 47 | + |
| 48 | +. Create a Secret named `secrets-rhdh` and add a key named `BACKEND_SECRET` with a `Base64-encoded` string as value: |
| 49 | ++ |
| 50 | +-- |
| 51 | +.`secrets-rhdh` fragment |
| 52 | +[source,yaml] |
| 53 | +---- |
| 54 | +apiVersion: v1 |
| 55 | +kind: Secret |
| 56 | +metadata: |
| 57 | + name: secrets-rhdh |
| 58 | +stringData: |
| 59 | + # TODO: See https://backstage.io/docs/auth/service-to-service-auth/#setup |
| 60 | + BACKEND_SECRET: "xxx" |
| 61 | +---- |
| 62 | + |
| 63 | +[IMPORTANT] |
| 64 | +==== |
| 65 | +Ensure that you use a unique value of `BACKEND_SECRET` for each {product-short} instance. |
| 66 | +==== |
| 67 | + |
| 68 | +You can use the following command to generate a key: |
| 69 | + |
| 70 | +[source,terminal] |
| 71 | +---- |
| 72 | +node-p'require("crypto").randomBytes(24).toString("base64")' |
| 73 | +---- |
| 74 | +-- |
| 75 | + |
| 76 | +. To enable pulling the PostgreSQL image from the {company-name} Ecosystem Catalog, add the image pull secret in the default service account within the namespace where the {product-short} instance is being deployed: |
| 77 | ++ |
| 78 | +-- |
| 79 | +[source,terminal] |
| 80 | +---- |
| 81 | +kubectl patch serviceaccount default \ |
| 82 | + -p '{"imagePullSecrets": [{"name": "rhdh-pull-secret"}]}' \ |
| 83 | + -n <your_namespace> |
| 84 | +---- |
| 85 | +-- |
| 86 | + |
| 87 | +. Create a Custom Resource file using the following template: |
| 88 | ++ |
| 89 | +-- |
| 90 | +.Custom Resource fragment |
| 91 | +[source,yaml,subs="attributes+"] |
| 92 | +---- |
| 93 | +apiVersion: rhdh.redhat.com/v1alpha1 |
| 94 | +kind: Backstage |
| 95 | +metadata: |
| 96 | + # This is the name of your {product-short} instance |
| 97 | + name: my-rhdh |
| 98 | +spec: |
| 99 | + application: |
| 100 | + imagePullSecrets: |
| 101 | + - "rhdh-pull-secret" |
| 102 | + route: |
| 103 | + enabled: false |
| 104 | + appConfig: |
| 105 | + configMaps: |
| 106 | + - name: "app-config-rhdh" |
| 107 | + extraEnvs: |
| 108 | + secrets: |
| 109 | + - name: "secrets-rhdh" |
| 110 | +---- |
| 111 | +-- |
| 112 | + |
| 113 | +. Set up a Google-managed certificate by creating a `ManagedCertificate` object which you must attach to the Ingress. |
| 114 | ++ |
| 115 | +-- |
| 116 | +.Example of a `ManagedCertificate` object |
| 117 | +[source,yaml,subs="attributes+"] |
| 118 | +---- |
| 119 | +apiVersion: networking.gke.io/v1 |
| 120 | +kind: ManagedCertificate |
| 121 | +metadata: |
| 122 | + name: <rhdh_certificate_name> |
| 123 | +spec: |
| 124 | + domains: |
| 125 | + - <rhdh_domain_name> |
| 126 | +---- |
| 127 | +-- |
| 128 | +For more information about setting up a Google-managed certificate, see https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs?hl=en#setting_up_a_google-managed_certificate[Setting up a Google-managed certificate]. |
| 129 | + |
| 130 | +. Create a `FrontendConfig` object to set a policy for redirecting to HTTPS. You must attach this policy to the Ingress. |
| 131 | ++ |
| 132 | +-- |
| 133 | +.Example of a `FrontendConfig` object |
| 134 | +[source,yaml,subs="attributes+"] |
| 135 | +---- |
| 136 | +apiVersion: networking.gke.io/v1beta1 |
| 137 | +kind: FrontendConfig |
| 138 | +metadata: |
| 139 | + name: <ingress_security_config> |
| 140 | +spec: |
| 141 | + sslPolicy: gke-ingress-ssl-policy-https |
| 142 | + redirectToHttps: |
| 143 | + enabled: true |
| 144 | +---- |
| 145 | +-- |
| 146 | +For more information about setting a policy to redirect to HTTPS, see https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-configuration?hl=en#https_redirect[HTTP to HTTPS redirects]. |
| 147 | + |
| 148 | +. Create an ingress resource using the following template, customizing the names as needed: |
| 149 | ++ |
| 150 | +-- |
| 151 | +.Example of an ingress resource configuration |
| 152 | +[source,yaml,subs="attributes+"] |
| 153 | +---- |
| 154 | +apiVersion: networking.k8s.io/v1 |
| 155 | +kind: Ingress |
| 156 | +metadata: |
| 157 | + # TODO: this the name of your Developer Hub Ingress |
| 158 | + name: my-rhdh |
| 159 | + annotations: |
| 160 | + # If the class annotation is not specified it defaults to "gce". |
| 161 | + kubernetes.io/ingress.class: "gce" |
| 162 | + kubernetes.io/ingress.global-static-ip-name: <ADDRESS_NAME> |
| 163 | + networking.gke.io/managed-certificates: <rhdh_certificate_name> |
| 164 | + networking.gke.io/v1beta1.FrontendConfig: <ingress_security_config> |
| 165 | +spec: |
| 166 | + ingressClassName: gce |
| 167 | + rules: |
| 168 | + # TODO: Set your application domain name. |
| 169 | + - host: <rhdh_domain_name> |
| 170 | + http: |
| 171 | + paths: |
| 172 | + - path: / |
| 173 | + pathType: Prefix |
| 174 | + backend: |
| 175 | + service: |
| 176 | + # TODO: my-rhdh is the name of your Backstage Custom Resource. |
| 177 | + # Adjust if you changed it! |
| 178 | + name: backstage-my-rhdh |
| 179 | + port: |
| 180 | + name: http-backend |
| 181 | +---- |
| 182 | +-- |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | +.Verification |
| 187 | + |
| 188 | +* Wait for the `ManagedCertificate` to be provisioned. This process can take a couple of hours. |
| 189 | + |
| 190 | +* Access {product-very-short} with `https://<rhdh_domain_name>` |
| 191 | + |
| 192 | +// Wait until the DNS name is responsive, indicating that your {product-short} instance is ready for use. |
| 193 | + |
| 194 | +.Additional information |
| 195 | +For more information on setting up {gke-short} using Ingress with TLS, see https://github.com/GoogleCloudPlatform/gke-networking-recipes/tree/main/ingress/single-cluster/ingress-https[Secure GKE Ingress]. |
0 commit comments