For the complete documentation index, see llms.txt. This page is also available as Markdown.

High Availability (HA)

Set up high availability on VM build infrastructure.

Minimum version

To use this feature, use drone runner version v1.0.0-rc.187 or later.

Architecture

Set up high availability

When using VM build infrastructure, you can deploy multiple runner replicas to ensure high availability. The following deployment YAML creates two runner replicas behind a load balancer.

---
apiVersion: v1
kind: Namespace
metadata:
  name: harness-delegate-ng
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: drone-runner
  namespace: harness-delegate-ng
spec:
  replicas: 2
  selector:
    matchLabels:
      app: drone-runner
  template:
    metadata:
      labels:
        app: drone-runner
    spec:
      containers:
        - name: drone-runner
          image: drone/drone-runner-aws:v1.0.0-rc.187
          args: ["delegate", "--pool", "/runner/pool.yml"]
          env:
            - name: DRONE_RUNNER_HA
              value: "true"
            - name: DRONE_DATABASE_DRIVER
              value: postgres
            - name: DRONE_DATABASE_DATASOURCE
              value: host=runnerha-postgres-service.harness-delegate-ng.svc.cluster.local port=5431 user=admin password=password dbname=dlite sslmode=disable
          ports:
            - containerPort: 3000
          volumeMounts:
            - name: config-volume
              mountPath: /runner
              readOnly: true
      volumes:
        - name: config-volume
          projected:
            sources:
              - configMap:
                  name: drone-runner-config
              - secret:
                  name: drone-runner-secret
---
apiVersion: v1
kind: Service
metadata:
  name: drone-runner-lb
  namespace: harness-delegate-ng
spec:
  type: LoadBalancer
  selector:
    app: drone-runner
  ports:
    - port: 3000
      targetPort: 3000
      protocol: TCP

Configure the preceding YAML:

  • Populate DRONE_DATABASE_DATASOURCE according to your database infrastructure.

  • The RUNNER_URL environment variable points to the machine where Harness Runner runs. Use the load balancer IP for RUNNER_URL in the delegate. For example, when installing the delegate:

    • Add -e RUNNER_URL=http://<LOAD_BALANCER_IP>:3000

  • The preceding YAML mounts the config-volume volume at /runner. Map the required pool.yml file and secrets. The following GCP-specific pool.yaml file is used in the deployment.

Last updated

Was this helpful?