Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

kubernetes python client

import os
from kubernetes import client, config

config.load_kube_config(
    os.path.join(os.environ["HOME"], '.kube/config'))

v1 = client.CoreV1Api()

pod_list = v1.list_namespaced_pod("default")
for pod in pod_list.items:
    print("%s	%s	%s" % (pod.metadata.name, 
                          pod.status.phase,
                          pod.status.pod_ip))
Source by www.ianlewis.org #
 
PREVIOUS NEXT
Tagged: #kubernetes #python #client
ADD COMMENT
Topic
Name
8+6 =