How to delete the resources or an application deployed through octopus in eks

Hi Team,

we are using Octopus server . and we have deployed our applications to pods in eks through Octopus deploy server.

Now , we would like to know ways / possibilities we can delete the resources or use the new resources .

If we have new version of our image /yaml files to be deployed and we do not want to use the old yaml files for a particular application

what are the best ways to do this from octopus deploy

Please let us know best practices

Greetings @kakarlayogitha, thanks for reaching out! Some of your question will depend on how you’re deploying to the EKS cluster as there are multiple ways this can be accomplished using Octopus Deploy. If you’re using the Deploy Kubernetes Containers step, you are able to choose/specify the version of the images to use. This step also controls the YAML so you wouldn’t need to worry about needing to modify it yourself.

The Deploy Raw Kubernetes YAML allows you to specify the YAML in one of two ways; directly inline with the step or provided as a package reference. In either case, you are in control of the YAML and the image versions they are to pull, Octopus will update the existing deployments/job/services with whatever has been provided in the YAML itself.

Lastly, some customers have opted to use the Run a Kubectl CLI script approach. Similar to the Deploy Raw Kubernetes YAML approach, you can provide directly inline with the step or provide a package.

Deleting resources in K8s through Octopus would be best done through the Run a Kubectl CLI script. If you have the YAML in a package, you can do a kubectl delete <YAML file(s) location> to remove an entire stack, or do things like kubectl delete deployment X.

Hope this helps!

Regards,

Shawn

Hello,

Thanks for the reply

we were deploying resources to our eks through the Run a Kubectl CLI script where all our project related files are stored in Octopus server in a drive .

we are using project variables to mention path and then deploy resources

now we need to delete resources which got created with this method

Please let us know best practice to follow

Awesome, thanks for the clarification. Would you be able to provide the script that you’re using in the Kubectl CLI script step?

Hello

we are running below command in powershell inline source code as our worker node is Windows server

kubectl apply -f {{varibale containing path of deployment yaml file}}

Hey there @kakarlayogitha! My understanding of how K8s works is that when applying a new YAML of an existing resource, it changes the resource to the new specification, including the image reference. If you need to run the delete, you can include a new Kubectl CLI step with kubectl delete -f {{variable containing path of deployment yaml file}} in your process, choosing the location/package of the previously deployed version.

Regards,

Shawn