[k8s] continue on finding router pod

This commit is contained in:
Nico Schottelius 2023-06-10 13:58:48 +02:00
parent 20ed1abc37
commit 32442484f9

View file

@ -49,17 +49,16 @@ v1 = client.CoreV1Api()
pods = v1.list_pod_for_all_namespaces(watch=False, pods = v1.list_pod_for_all_namespaces(watch=False,
label_selector="app.kubernetes.io/component=bird") label_selector="app.kubernetes.io/component=bird")
print("Number of pods: " + str(len(pods.items))) num_pods = len(pods.items)
for i in pods.items: print("Number of pods: " + str(num_pods))
pod=i.metadata.name if not num_pods == 1:
print(f"Pod: {pod}") print(f"There should be exactly 1 matching pod - there are {num_pods} pods")
sys.exit(1)
pod=pods.items[0].metadata.name
print(f"Pod: {pod}")
os.environ["KUBECONFIG"] = k8sconfig os.environ["KUBECONFIG"] = k8sconfig
cmd = f"kubectl exec -ti {pod} -c bird -- sh" cmd = f"kubectl exec -ti {pod} -c bird -- sh"
p = subprocess.run(cmd, shell=True) p = subprocess.run(cmd, shell=True)
#POD=$(kubectl -n rook-ceph get pods \
# -l app=rook-ceph-tools --output=jsonpath={.items..metadata.name})
#
#kubectl -n rook-ceph exec -ti $POD -- bash