Shell script to push kube status to an api

6/30/2020

Hi am srinivasa I need to write a script to push kubernetes status to an api there i need to grep only some columns after that i need to convert that output into json next i need to push that json output into my api please help me for this to write a script am a begginer to the scripting

my kubectl get pods output is

NAME                                             READY   STATUS    RESTARTS   AGE
prometheus-alertmanager-df7d48c78-ctv52          2/2     Running   0          83d
prometheus-kube-state-metrics-6cd8cdc7b7-qx9n5   1/1     Running   0          83d
prometheus-node-exporter-ld56h                   1/1     Running   0          83d
prometheus-node-exporter-prtlw                   1/1     Running   0          83d
prometheus-node-exporter-rbgff                   1/1     Running   0          83d
prometheus-node-exporter-z9rvs                   1/1     Running   0          83d
prometheus-pushgateway-655f59475-fjrrf           1/1     Running   0          83d
prometheus-server-577d8b886-gn5qg                2/2     Running   0          83d

in this i need to grep only name ready and status columns only i didt find exact filter options please help me for this

-- srijay
bash
kubernetes
shell

0 Answers