Reputation: 27
Is there a way to export list of pods that you get when you run command 'kubectl get pods -n name_of_your_namespace '? I am trying to automate some everyday work with PowerShell scripss and i would like to export list of running pods in namespace to json or csv, then check that json or csv files if those running pods are that I want and then to save names of those pods into variables and use them in other PowerShell scripts.
So for now I need just a way to export results that you get when 'kubectl get pods' command is run.
Upvotes: -1
Views: 5703
Reputation: 1481
The Below command will generate a csv file by having all columns
kubectl get pods -n mynamespace | tr -s '[:blank:]' ',' > output.csv
Upvotes: 2
Reputation: 27
Forgot about this question. I've found solution to problem I had. The command was very simple.
kubectl get pods -o=name > $pathToFile(you desired path to file in format 'C:/Folder/test.csv' -n $namespace
And @DazWilkin, thank you for your suggestion.
Upvotes: 0