Chapter 2. Deploying Developer Hub on AKS with the Helm chart
Chapter 2. Deploying Developer Hub on AKS with the Helm chart 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 kubectl CLI . You are logged into your cluster using kubectl , and have developer or admin permissions. 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 denied when attempting certain operations. This error can be addressed by adjusting the fsGroup in the PodSpec.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> Tip You 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 Note After you install the Ingress Controller, the app-routing-system namespace 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}' Namespace management : You can create a dedicated namespace for Developer Hub deployment in AKS using the following command: kubectl create namespace <your_namespace> Procedure Log in to AKS by running the following command: az login [--tenant=<optional_directory_name>] Create a resource group by running the following command: az group create --name <resource_group_name> --location <location> Tip You can list available regions by running the following command: az account list-locations -o table 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 You can refer to --help for additional options. Connect to your cluster by running the following command: az aks get-credentials --resource-group <resource_group_name> --name <cluster_name> The command configures the Kubernetes client and sets the current context in the kubeconfig to 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/ Create and activate the <my-rhdh-project> namespace: DEPLOYMENT_NAME=<redhat-developer-hub> NAMESPACE=<rhdh> kubectl create namespace USD{NAMESPACE} kubectl config set-context --current --namespace=USD{NAMESPACE} 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 USDNAMESPACE create secret docker-registry rhdh-pull-secret \ --docker-server=registry.redhat.io \ --docker-username=<redhat_user_name> \ --docker-password=<redhat_password> \ --docker-email=<email> Create a file named values.yaml using the following template: global: host: <app_address> route: enabled: false upstream: ingress: enabled: true className: webapprouting.kubernetes.azure.com host: backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 3000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true To install Developer Hub by using the Helm chart, run the following command: helm -n USDNAMESPACE install -f values.yaml USDDEPLOYMENT_NAME openshift-helm-charts/redhat-developer-hub --version 1.4.2 Verify the deployment status: kubectl get deploy USDDEPLOYMENT_NAME -n USDNAMESPACE Configure your Developer Hub Helm chart instance with the Developer Hub database password and router base URL values from your cluster: PASSWORD=USD(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) CLUSTER_ROUTER_BASE=USD(kubectl get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') helm upgrade USDDEPLOYMENT_NAME -i "https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.4.2/redhat-developer-hub-1.4.2.tgz" \ --set global.clusterRouterBase="USDCLUSTER_ROUTER_BASE" \ --set global.postgresql.auth.password="USDPASSWORD" Display the running Developer Hub instance URL, by running the following command: echo "https://USDDEPLOYMENT_NAME-USDNAMESPACE.USDCLUSTER_ROUTER_BASE" 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 USDDEPLOYMENT_NAME -i https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.4.2/redhat-developer-hub-1.4.2.tgz Delete To delete the deployment, run the following command: helm -n USDNAMESPACE delete USDDEPLOYMENT_NAME
az aks approuting enable --resource-group <your_ResourceGroup> --name <your_ClusterName> az extension add --upgrade -n aks-preview --allow-preview true get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}' create namespace <your_namespace> az login [--tenant=<optional_directory_name>] az group create --name <resource_group_name> --location <location> az account list-locations -o table az aks create --resource-group <resource_group_name> --name <cluster_name> --enable-managed-identity --generate-ssh-keys az aks get-credentials --resource-group <resource_group_name> --name <cluster_name> helm repo add openshift-helm-charts https://charts.openshift.io/ DEPLOYMENT_NAME=<redhat-developer-hub> NAMESPACE=<rhdh> create namespace USD{NAMESPACE} config set-context --current --namespace=USD{NAMESPACE} -n USDNAMESPACE create secret docker-registry rhdh-pull-secret --docker-server=registry.redhat.io --docker-username=<redhat_user_name> --docker-password=<redhat_password> --docker-email=<email> global: host: <app_address> route: enabled: false upstream: ingress: enabled: true className: webapprouting.kubernetes.azure.com host: backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 3000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true helm -n USDNAMESPACE install -f values.yaml USDDEPLOYMENT_NAME openshift-helm-charts/redhat-developer-hub --version 1.4.2 get deploy USDDEPLOYMENT_NAME -n USDNAMESPACE PASSWORD=USD(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) CLUSTER_ROUTER_BASE=USD(kubectl get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') helm upgrade USDDEPLOYMENT_NAME -i "https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.4.2/redhat-developer-hub-1.4.2.tgz" --set global.clusterRouterBase="USDCLUSTER_ROUTER_BASE" --set global.postgresql.auth.password="USDPASSWORD" echo "https://USDDEPLOYMENT_NAME-USDNAMESPACE.USDCLUSTER_ROUTER_BASE" helm upgrade USDDEPLOYMENT_NAME -i https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.4.2/redhat-developer-hub-1.4.2.tgz helm -n USDNAMESPACE delete USDDEPLOYMENT_NAME