1

is there any possibility to cut off the id part of the pod name? I just need the application name.

Here is an example:

I get the list of pods with the command: kubectl get pod --all-namespaces -o=custom-columns=NAME:.metadata.name --field-selector status.phase=Running

  • blabla-admin-management-6779fdc6db-6zp5z
  • event-default-stan-0
  • kube-prometheus-stack-prometheus-node-exporter-q574j
  • aws-node-lzrse

But I need the following output:

  • blabla-admin-management
  • event-default-stan
  • kube-prometheus-stack-prometheus-node-exporter
  • aws-node

I wrote a bash script which identifies the parts with numbers in it to cut them off, but it does not work for all examples, see aws-node-lzrse.

Sup3rwoman
  • 11
  • 1

0 Answers0