kubernetes-client / kubernetes-client/python

v36.0.0 regression fetching container logs

Open
#2,596 11 comments 2 reactions 1 assignee Claimed by @yliaog View on GitHub
kind/bug
Dominant language
Python
Stars
7.7k
Forks
3.5k
Avg merge
1d 14h
Merged PRs (30d)
18

Description

**What happened (please include outputs or screenshots)**:

As of upgrading kubernetes to 36.0.0, something looks wrong in `read_namespaced_pod_log`

**What you expected to happen**:

Getting log lines out of my containers

**How to reproduce it (as minimally and precisely as possible)**:

```
since_secs = 600
l = pod_api.read_namespaced_pod_log(namespace="foo-ns",
name="foo-pod",
container="foo-container",
follow=False,
timestamps=True,
since_seconds=600)
print("logs first chars:", l[:100])
```

Running with kubernetes 35.0.0, last line logged would say

```
logs first chars: 2026-05-25T07:52:34.381816807Z [25/05/2026 07:52:34] [MainThread] xxxx
```

Switching to 36.0.0. Same code outputs:

```
logs first chars: b'2026-05-24T15:57:23.246955706Z [24/05/2026 15:57:23] [MainThread]
```

Got confused at first, try to cast it or decode it into a string .... but no: this is a string already.
That `b'` are just the two first characters of my string.

Setting timestamps=False doesn't change anything, I'm still getting that `b'` prefix.

**Anything else we need to know?**:

**Environment**:
- Kubernetes version (`kubectl version`): v1.31.14
- Python version (`python --version`) 3.12.13
- Python client version (`pip list | grep kubernetes`) 36.0.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.