You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import json
import requests
r = requests.get("http://127.0.0.1:8001/api/v1/watch/pods", stream=True)
# fullback encoding for bya-data
if r.encoding is None:
r.encoding = 'utf-8'
lines = r.iter_lines(decode_unicode=True)
for line in lines:
if line:
# load the bya-json to a string
data = json.loads(line)
# dumps the json object into an element
json_data = json.dumps(data['object']['status'], indent=2)
print(json_data)
kareem-elsayed
changed the title
Get pods status from k8s api
[FEATURE] Get pods status from k8s api
Jun 4, 2020
We can use the
/api/v1/watch/pods
endpoint to get and watch the status events for the pods instead of usingkubectl
toolThe text was updated successfully, but these errors were encountered: