Install delegates with custom certificates
This topic explains how to install Kubernetes, Docker, and Helm delegates with custom certificates.
The installation steps are different depending on your delegate version.
If your delegate with an immutable image type version is later than 81202 (image tag 23.10.81202), go to Install with custom certificates.
If your delegate with an immutable image type version is earlier than 81202 (image tag 23.10.81202), go to Install with custom truststore.
For information on delegate types, go to Delegate image types.
Install with custom certificates
Use the steps below to install custom certificates for a Docker, Kubernetes, or Helm delegate with an an immutable image type version later than 23.10.81202.
You might need additional permissions to execute commands in delegate scripts and create Harness users.
- Docker delegate
- Kubernetes delegate
- Helm delegate
To install a Docker delegate with custom certificates, do the following:
-
Prepare the custom cert file(s).
noteCertificates must be PEM format.
-
Mount the file(s) to the
/opt/harness-delegate/ca-bundle/
directory inside the delegate container. -
Start the delegate with the root user.
Example: Mount custom certs from a folder
docker run --cpus=1 -u root --memory=2g \
-v PUT_YOUR_PATH_TO_FOLDER_OF_CUSTOM_CERTS:/opt/harness-delegate/ca-bundle \
-e DELEGATE_NAME=PUT_YOUR_DELEGATE_NAME \
-e NEXT_GEN="true" \
-e DELEGATE_TYPE="DOCKER" \
-e ACCOUNT_ID=PUT_YOUR_HARNESS_ACCOUNTID_HERE \
-e DELEGATE_TOKEN=PUT_YOUR_HARNESS_ACCOUNTID_HERE \
-e LOG_STREAMING_SERVICE_URL=PUT_YOUR_MANAGER_HOST_AND_PORT_HERE/log-service/ \
-e MANAGER_HOST_AND_PORT=PUT_YOUR_MANAGER_HOST_AND_PORT_HERE harness/delegate:yy.mm.vernoExample: Mount a single custom cert or a CA bundle file
docker run --cpus=1 -u root --memory=2g \
-v PUT_YOUR_PATH_TO_CUSTOM_CERT:/opt/harness-delegate/ca-bundle/abc.pem \
-e DELEGATE_NAME=PUT_YOUR_DELEGATE_NAME \
-e NEXT_GEN="true" \
-e DELEGATE_TYPE="DOCKER" \
-e ACCOUNT_ID=PUT_YOUR_HARNESS_ACCOUNTID_HERE \
-e DELEGATE_TOKEN=PUT_YOUR_HARNESS_ACCOUNTID_HERE \
-e LOG_STREAMING_SERVICE_URL=PUT_YOUR_MANAGER_HOST_AND_PORT_HERE/log-service/ \
-e MANAGER_HOST_AND_PORT=PUT_YOUR_MANAGER_HOST_AND_PORT_HERE harness/delegate:yy.mm.verno
To install a Kubernetes delegate with custom certificates, do the following:
-
Create a Kubernetes secret with the custom cert file.
kubectl create secret -n harness-delegate-ng generic mycerts --from-file custom-certs.pem=custom_certs.pem
noteYou can install multiple certificates by adding additional
--from-file
arguments. For example:kubectl create secret -n harness-delegate-ng generic mycerts \
--from-file custom-certs1.pem=site1cert.pem \
--from-file custom-certs2.pem=site2cert.pem \
--from-file custom-certs3.pem=site3cert.pem -
Modify the
harness-delegate.yaml
file to include a volume mount. Mount the secret to the/opt/harness-delegate/ca-bundle/
directory.volumeMounts:
- mountPath: /opt/harness-delegate/ca-bundle/
name: custom-certs
readOnly: true
volumes:
- name: custom-certs
secret:
secretName: mycerts
defaultMode: 400 -
Set the security context to provide operator access to the mounted files.
securityContext:
fsGroup: 1001 -
Use the root user.
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0