Installing Red Hat Developer Hub on Microsoft Azure Kubernetes Service
Abstract
Preface Copy linkLink copied to clipboard!
You can install Red Hat Developer Hub on Microsoft Azure Kubernetes Service (AKS) using one of the following methods:
- The Red Hat Developer Hub Operator
- The Red Hat Developer Hub Helm chart
Chapter 1. Deploying Developer Hub on AKS with the Operator Copy linkLink copied to clipboard!
You can deploy your Developer Hub on AKS using the Red Hat Developer Hub Operator.
Procedure
Obtain the Red Hat Developer Hub Operator manifest file, named
rhdh-operator-<VERSION>.yaml, and modify the default configuration ofdb-statefulset.yamlanddeployment.yamlby adding the following fragment:securityContext: fsGroup: 300
securityContext: fsGroup: 300Copy to Clipboard Copied! Toggle word wrap Toggle overflow Following is the specified locations in the manifests:
db-statefulset.yaml: | spec.template.spec deployment.yaml: | spec.template.spec
db-statefulset.yaml: | spec.template.spec deployment.yaml: | spec.template.specCopy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the modified Operator manifest to your Kubernetes cluster:
kubectl apply -f rhdh-operator-<VERSION>.yaml
kubectl apply -f rhdh-operator-<VERSION>.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteExecution of the previous command is cluster-scoped and requires appropriate cluster privileges.
Create an
ImagePull Secretnamedrhdh-pull-secretusing your Red Hat credentials to access images from the protectedregistry.redhat.ioas shown in the following example:kubectl -n <your_namespace> 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 <your_namespace> 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 an Ingress manifest file, named
rhdh-ingress.yaml, specifying your Developer Hub service name as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To deploy the created Ingress, run the following command:
kubectl -n <your_namespace> apply -f rhdh-ingress.yaml
kubectl -n <your_namespace> apply -f rhdh-ingress.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a ConfigMap named
app-config-rhdhcontaining the Developer Hub configuration using the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Secret named
secrets-rhdhand add a key namedBACKEND_SECRETwith aBase64-encodedstring value as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Custom Resource (CR) manifest file named
rhdh.yamland include the previously createdrhdh-pull-secretas follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the CR manifest to your namespace:
kubectl -n <your_namespace> apply -f rhdh.yaml
kubectl -n <your_namespace> apply -f rhdh.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Access the deployed Developer Hub using the URL:
https://<app_address>, where <app_address> is the Ingress address obtained earlier (for example,https://108.141.70.228). Optional: To delete the CR, run the following command:
kubectl -n <your_namespace> delete -f rhdh.yaml
kubectl -n <your_namespace> delete -f rhdh.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 2. Deploying Developer Hub on AKS with the Helm chart Copy linkLink copied to clipboard!
You can deploy your Developer Hub application on Azure Kubernetes Service (AKS) to access a comprehensive solution for building, testing, and deploying applications.
Prerequisites
- You have a Microsoft Azure account with active subscription.
- You have installed the Azure CLI.
-
You have installed the
kubectlCLI. -
You are logged into your cluster using
kubectl, and havedeveloperoradminpermissions. - You have installed Helm 3 or the latest.
Comparison of AKS specifics with the base Developer Hub deployment
-
Permissions issue: Developer Hub containers might encounter permission-related errors, such as
Permission deniedwhen attempting certain operations. This error can be addresssed by adjusting thefsGroupin thePodSpec.securityContext. Ingress configuration: In AKS, configuring ingress is essential for accessing the installed Developer Hub instance. Accessing the Developer Hub instance requires enabling the Routing add-on, an NGINX-based Ingress Controller, using the following command:
az aks approuting enable --resource-group <your_ResourceGroup> --name <your_ClusterName>
az aks approuting enable --resource-group <your_ResourceGroup> --name <your_ClusterName>Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipYou might need to install the Azure CLI extension
aks-preview. If the extension is not installed automatically, you might need to install it manually using the following command:az extension add --upgrade -n aks-preview --allow-preview true
az extension add --upgrade -n aks-preview --allow-preview trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAfter you install the Ingress Controller, the
app-routing-systemnamespace with the Ingress Controller will be deployed in your cluster. Note the address of your Developer Hub application from the installed Ingress Controller (for example, 108.141.70.228) for later access to the Developer Hub application, later referenced as<app_address>.kubectl get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}'kubectl get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Namespace management: You can create a dedicated namespace for Developer Hub deployment in AKS using the following command:
kubectl create namespace <your_namespace>
kubectl create namespace <your_namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Log in to AKS by running the following command:
az login [--tenant=<optional_directory_name>]
az login [--tenant=<optional_directory_name>]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a resource group by running the following command:
az group create --name <resource_group_name> --location <location>
az group create --name <resource_group_name> --location <location>Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipYou can list available regions by running the following command:
az account list-locations -o table
az account list-locations -o tableCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create an AKS cluster by running the following command:
az aks create \ --resource-group <resource_group_name> \ --name <cluster_name> \ --enable-managed-identity \ --generate-ssh-keys
az aks create \ --resource-group <resource_group_name> \ --name <cluster_name> \ --enable-managed-identity \ --generate-ssh-keysCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can refer to
--helpfor additional options.Connect to your cluster by running the following command:
az aks get-credentials --resource-group <resource_group_name> --name <cluster_name>
az aks get-credentials --resource-group <resource_group_name> --name <cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow The previous command configures the Kubernetes client and sets the current context in the
kubeconfigto point to your AKS cluster.Open terminal and run the following command to add the Helm chart repository:
helm repo add openshift-helm-charts https://charts.openshift.io/
helm repo add openshift-helm-charts https://charts.openshift.io/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create and activate the <rhdh> namespace:
DEPLOYMENT_NAME=<redhat-developer-hub> NAMESPACE=<rhdh> kubectl create namespace ${NAMESPACE} kubectl config set-context --current --namespace=${NAMESPACE}DEPLOYMENT_NAME=<redhat-developer-hub> NAMESPACE=<rhdh> kubectl create namespace ${NAMESPACE} kubectl config set-context --current --namespace=${NAMESPACE}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a pull secret, which is used to pull the Developer Hub images from the Red Hat Ecosystem, by running the following command:
kubectl -n $NAMESPACE 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 $NAMESPACE 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 file named
values.yamlusing the following template:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To install Developer Hub by using the Helm chart, run the following command:
helm -n $NAMESPACE install -f values.yaml $DEPLOYMENT_NAME openshift-helm-charts/redhat-developer-hub --version 1.3.5
helm -n $NAMESPACE install -f values.yaml $DEPLOYMENT_NAME openshift-helm-charts/redhat-developer-hub --version 1.3.5Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the deployment status:
kubectl get deploy $DEPLOYMENT_NAME -n $NAMESPACE
kubectl get deploy $DEPLOYMENT_NAME -n $NAMESPACECopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure your Developer Hub Helm chart instance with the Developer Hub database password and router base URL values from your cluster:
PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) CLUSTER_ROUTER_BASE=$(kubectl get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') helm upgrade $DEPLOYMENT_NAME -i "https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.3.5/redhat-developer-hub-1.3.5.tgz" \ --set global.clusterRouterBase="$CLUSTER_ROUTER_BASE" \ --set global.postgresql.auth.password="$PASSWORD"PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) CLUSTER_ROUTER_BASE=$(kubectl get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') helm upgrade $DEPLOYMENT_NAME -i "https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.3.5/redhat-developer-hub-1.3.5.tgz" \ --set global.clusterRouterBase="$CLUSTER_ROUTER_BASE" \ --set global.postgresql.auth.password="$PASSWORD"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the running Developer Hub instance URL, by running the following command:
echo "https://$DEPLOYMENT_NAME-$NAMESPACE.$CLUSTER_ROUTER_BASE"
echo "https://$DEPLOYMENT_NAME-$NAMESPACE.$CLUSTER_ROUTER_BASE"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- Open the running Developer Hub instance URL in your browser to use Developer Hub.
Upgrade
To upgrade the deployment, run the following command:
helm upgrade $DEPLOYMENT_NAME -i https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.3.5/redhat-developer-hub-1.3.5.tgz
helm upgrade $DEPLOYMENT_NAME -i https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.3.5/redhat-developer-hub-1.3.5.tgzCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Delete
To delete the deployment, run the following command:
helm -n $NAMESPACE delete $DEPLOYMENT_NAME
helm -n $NAMESPACE delete $DEPLOYMENT_NAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow