uncloud-mravi/k8s-python/test-log.py
2025-03-08 11:04:46 +09:00

13 lines
420 B
Python

from kubernetes.client.rest import ApiException
from kubernetes import client, config
import sys
config.load_kube_config()
pod_name = sys.argv[1]
try:
api_instance = client.CoreV1Api()
api_response = api_instance.read_namespaced_pod_log(name=pod_name, namespace='default', container="zammad-railsserver")
print(api_response)
except ApiException as e:
print(f"Found exception in reading the logs: {e}")