get_logs_for_pod_and_container
Retrieves logs from a specified Kubernetes pod and container using namespace and pod name. Helps diagnose issues by fetching container-specific log data from clusters.
Instructions
Retrieves logs from a Kubernetes pod and container.
Args:
namespace (str): The namespace of the pod.
pod_name (str): The name of the pod.
container_name (str, optional): The name of the container within the pod.
If None, defaults to the first container.
Returns:
str, optional: Log content if any found for this pod/container, or None otherwise
Raises
------
K8sConfigError
If unable to initialize the K8S API.
K8sApiError
If the API call to fetch logs fails or an unexpected error occurs.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
container_name | No | ||
namespace | No | default | |
pod_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"container_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Container Name"
},
"namespace": {
"default": "default",
"title": "Namespace",
"type": "string"
},
"pod_name": {
"title": "Pod Name",
"type": "string"
}
},
"required": [
"pod_name"
],
"title": "get_logs_for_pod_and_containerArguments",
"type": "object"
}