Skip to content

Instantly share code, notes, and snippets.

@aborilov
Created February 18, 2016 07:00
Show Gist options
  • Save aborilov/3c4116ec494d3d88d7b1 to your computer and use it in GitHub Desktop.
Save aborilov/3c4116ec494d3d88d7b1 to your computer and use it in GitHub Desktop.
get pod from kubernetes
# coding: utf-8
import requests
resp = requests.get('https://127.0.0.1/api/podapi', auth=('test', '1'), verify=False)
pods = resp.json()
namespace = pods['data'][0]['id']
resp = requests.get('http://localhost:8080/api/v1/namespaces/{}/pods'.format(namespace))
pod = resp.json()
print pod['items'][0]['spec']['containers']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment