Skip to content

[request] add -o csv for easy exporting of resources to spreadsheets. #995

Open
@Bjohnson131

Description

@Bjohnson131

What would you like to be added:
I would like to be able to use the output flag to specify csv format when listing resources. For example:
kubectl get pods -o csv would output the current pods in a CSV format.
An example of proper CSV format could be

NAME    ,READY   ,STATUS    ,RESTARTS   ,AGE
Inky    ,1/1     ,Running   ,3          ,1d10h
Blinky  ,1/1     ,Running   ,132        ,2d11h
Pinky   ,1/1     ,Running   ,2          ,3d12h
Clyde   ,1/1     ,Running   ,0          ,196d13h

Which in monospace would not only look like properly formatted CSV, but it would also be properly formatted CSV.

This flag would be valid on any resource that is 'get'-able.

Why is this needed:

Not only is this an easy add, as it would be very useful in automation and reporting. Personally, I would be able to perform cluster analysis much faster with this, using something akin to

kubectl get pods -o csv > myreport.csv

where I could then paste in formulas in excel and crunch numbers with my own parser.

Thanks for the consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions