This document walks you through the steps to follow to Run the Initialization Scripts on Delegates in Harness NextGen.
The Delegate setup files enable you to run startup scripts on the host/container/pod for a Harness Delegate when the Delegate was installed.
You can also add script after the Delegate is installed and then restart the Delegate.
INIT_SCRIPTis typically used for Legacy Delegates.
INIT_SCRIPTis typically not used for Immutable Delegates. The initialization should be baked into the image for the Immutable Delegate, not executed on startup.
When you install a Delegate, you are prompted to download its config file. For Kubernetes and Docker Delegates, this is a YAML file.
Download the file and open it in a text editor. Locate the Environment variable
INIT_SCRIPT in the
The above-used INIT_SCRIPT is used to Installing Serverless on the K8sDelegate.
kubectl apply -f harness-delegate.yml
Check the Delegate pod/host/container to see if the script ran correctly.
Log in to the Kubernetes cluster where your delegate is running.
kubectl get statefulsets -n delegate-namespace get the details of your stateful-sets using this command.
kubectl edit statefulset/statefulset name -n delegate-namespace using this command, you can edit your delegate.yaml and add the required INIT_SCRIPT on an already existing delegate.
Once you have done the changes check whether pods are recreated using kubectl get pods -n namespace and you are good to use the delegate with serverless deployments.
You can find more information on how to Run Initialization Scripts on Delegates in our documentation here: Run Initialization Scripts on Delegates - Harness Docs