openshiftopenshift-client-tools

How to delete a file in persistent volume through CLI in Openshift


I'm trying to delete a file that is stored in persistent volume through CLI. I know the path but not sure how do I through CLI delete the file. Reason I want to do it through CLI is that I am automating a certain workflow that requires triggering of a powershell script that runs OpenShift CLI to delete a file in volume and scale down.


Solution

  • How about Executing Remote Commands feature to remove the file as follows.

    For example,

    # oc exec <pod name> -- rm -f /path/to/file.txt
    

    I hope it help you.