Configuring an external agent for Build in DevOps Loop

You can configure an external Build agent to connect with DevOps Loop installed on Kubernetes (K8s), Azure Kubernetes Service (AKS), IBM Kubernetes Service (IKS), or OpenShift Container Platform (OCP).

Before you begin, ensure the following prerequisites are met:

  • Installed DevOps Loop on Kubernetes (K8s), Azure Kubernetes Service (AKS), IKS, or OCP.
  • Ensured that you have access to the Kubernetes or OpenShift cluster where DevOps Loop is running.
  • Installed the DevOps Build agent on a supported external platform.
  • Been granted permissions to edit services or create routes in the cluster.
  1. Edit the Emissary ingress service to expose the Build agent port for Kubernetes (K8s), Azure Kubernetes Service (AKS), or IKS deployments.
    1. Run the following command:
      kubectl edit svc emissary-ingress -n emissary
    2. Under the spec.ports section, add the following configuration:
      - name: build-agent
      nodePort: 31123
      port: 7920
      protocol: TCP
      targetPort: 7920                    
  2. Update the installed.properties file of the agent located at <agent-install-dir>/conf/agent with the cluster domain and port.
    1. For Kubernetes (K8s) environments:
      locked/agent.brokerUrl=failover:(ah3://{{.Values.global.domain}}:7920)
      locked/agent.jms.remote.host={{.Values.global.domain}}
      locked/agent.jms.remote.port=7920          

      Values.global.domain is the same URL used to access the DevOps Loop UI.

    2. For IKS environments:
      locked/agent.brokerUrl=failover:(ah3://<service-domain>:7920)
      locked/agent.jms.remote.host=<service-domain>
      locked/agent.jms.remote.port=7920     

      <service-domain> is the domain configured for the IKS cluster in Step 4.

  3. Start the external Build agent by running the following command:
    sudo <agent-install-dir>/bin/agent run
    The agent is displayed under the Agents section in the Build UI.
  4. For IKS, configure the cluster service domain, if it is not configured.
    Follow steps in the Installing DevOps Loop on IBM Cloud Kubernetes Service (IKS) topic for setting up the service domain.
  5. Optional: If the above approach does not work, use the following alternate method for a Kubernetes cluster running on a demo RHEL setup.
    1. Patch the service to expose an external IP and port.
      Run the following commands:
      kubectl patch svc devops-build-server -n devops-loop --type=merge -p '{"spec":{"externalIPs":["<machine-ip>"]}}'
      kubectl patch svc devops-build-server -n devops-loop --type=json -p='[{"op":"replace","path":"/spec/ports/2/port","value":<required-port>}]'
      Replace <machine-ip> and <required-port> with appropriate values. Ensure that the specified port allows inbound and outbound traffic from the host machine where the external agent is running.
    2. Update the installed.properties file of the agent.
      locked/agent.brokerUrl=failover:(ah3://<machine-ip>.nip.io:<required-port>)
      locked/agent.jms.remote.host=<machine-ip>.nip.io
      locked/agent.jms.remote.port=<required-port>
  6. For OpenShift deployments, create a route to expose the Build agent service.
    1. Apply the following route definition:
      cat <<EOF | oc apply -n <namespace> -f -
      apiVersion: route.openshift.io/v1
      kind: Route
      metadata:
      name: devops-build-agent
      spec:
      to:
      kind: Service
      name: devops-build-server
      port:
      targetPort: agent
      tls:
      termination: passthrough
      insecureEdgeTerminationPolicy: Redirect
      EOF                    
    2. Retrieve the route host by running the following command:
      oc get route devops-build-agent
    3. Update the installed.properties file of the agent located at <agent-install-dir>/conf/agent as follows:
      locked/agent.brokerUrl=failover:(ah3://<route-host>:443)
      locked/agent.jms.remote.host=<route-host>
      locked/agent.jms.remote.port=443                    
    4. Start the external Build agent by running the following command:
      sudo <agent-install-dir>/bin/agent run
      The agent is displayed under the Agents section in the Build UI.

You have configured the external Build agent and connected it to DevOps Loop.

You can now run jobs on this agent.