From 71ee0cfe7c132b1478e9fde90b388665ef6c696c Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Tue, 15 Dec 2020 13:57:50 +0800 Subject: [PATCH] Add k8s client - test --- main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.py b/main.py index a661d42..fe8243d 100644 --- a/main.py +++ b/main.py @@ -13,10 +13,15 @@ from routes import * from logging import error, info from subprocess import STDOUT, CalledProcessError, check_output from itertools import islice +from kubernetes import client, config app.register_blueprint(routes) def get_namespaces(): + config.load_incluster_config() + v1 = client.Corev1Api() + ns = v1.list_namespace() + print(ns) command = "/usr/local/bin/kubectl get ns -ojson" info(f"Running command: {command}") try: