Delete a delegate
This topic describes how to delete a delegate from your Kubernetes cluster and Harness installation.
Identify the delegate type
This is an End of Support (EOS) notice for the Delegate-Legacy image type. This image type reached End of Support (EOS) as of January 31, 2024.
End of Support means the following:
- Harness Support will no longer accept support requests for the Delegate-Legacy image type in both Harness FirstGen and Harness NextGen (including Harness Self-Managed Enterprise Edition (SMP)).
- Security fixes will still be addressed.
- Product defects will not be addressed.
Follow the below steps to upgrade Delegate-Legacy to Delegate image
- Download new yaml from Harness by keeping the same name as the previous delegate
- Check if the existing delegate has any tags/selector, if yes then add them in DELEGATE_TAGS
- Compare the permissions given to the legacy delegate in their yaml and give the same permissions to new delegates
- Check if custom image is used, if yes then build a new image with immutable delegate as base image and override the account setting to point to that image
- Ensure that auto upgrade is enabled for Kubernetes delegates
- Our delegate yaml ships with default HPA of min and max replicas to be 1, adjust the desired number of replicas in HPA
- Deploy the new yaml and see new replicas coming under the same delegate
- Scale down the old stateful set and verify that everything is correct
Harness Delegate is installed as a Kubernetes Deployment object. A legacy delegate, on the other hand, is installed as a Kubernetes StatefulSet object. This means that the process used to delete a legacy delegate differs from the process used to delete Harness Delegate.
You can verify the delegate you're using by looking at its manifest file or by running kubectl get all -n harness-delegate-ng
.
To delete a legacy delegate, go to the Delete a legacy delegate section.
Delete a delegate
Use the following process to delete a delegate.
Step 1: Delete the deployment for the delegate
To delete a delegate from your Kubernetes cluster, you delete the Deployment object that represents its deployment.
kubectl delete deployment -n harness-delegate-ng <Deployment name>
Use the following command to retrieve a list of deployments:
kubectl get deployments
The deployment name is specified in the metadata.name
field of the Kubernetes manifest you used to install the delegate.
...
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
harness.io/name: doc-demos
name: doc-demos
namespace: harness-delegate-ng
...
In this example, the name
field is specified as doc-demos
.
Next, delete the Updater CronJob:
kubectl delete cronjob -n harness-delegate-ng <Deployment name>-upgrader-job
For example, if the Deployment name is quickstart-delegate
:
kubectl delete cronjob -n harness-delegate-ng quickstart-delegate-upgrader-job
Step 2: Delete the delegate in Harness
Locate the delegate in the Harness account/Project/Org, select more options (⋮), and then select Delete.
Delete replica pods
Deleted replica pods unregister and clear out during shutdown after they complete all running tasks if the graceful shutdown period is sufficient. The grace period is configurable. For more information on graceful shutdown, go to Graceful delegate shutdown.
If you do not delete the delegate in the UI, Harness automatically removes it after six hours.
Delete a legacy delegate
Use the following process to delete a legacy delegate.
Step 1: Delete the StatefulSet for the delegate
To delete a legacy delegate from your Kubernetes cluster, you delete the StatefulSet object that represents its deployment.
A StatefulSet resource is ensures that the desired number of pods are running and available at all times. If you delete a pod that belongs to a StatefulSet without deleting the StatefulSet itself, the pod is recreated.
For example, you can use the following command to delete the StatefulSet that created a delegate pod named quickstart-vutpmk-0
:
$ kubectl delete statefulset -n harness-delegate-ng quickstart-vutpmk
The name of the delegate pod includes the name of the StatefulSet followed by the pod identifier -0
.
Step 2: Delete the delegate in Harness
Locate the delegate in the Harness account/Project/Org, select more options (⋮), and then select Delete.