Using the follow parameter when fetching Pod logs from the browser via the Rest API does not get the latest log content

A very strange question. When I make a request to fetch the Pod log in the browser, it doesn’t return the latest content, but cURL makes the same request to fetch it. Does anyone know why?

This is the result you get in the browser, and you can see that the latest log entry was 11:20.

This is a cURL request to the same address, and the latest log entry is 15:55, which is correct.

If you’re using Kubernetes, you’re likely interacting with the Kubernetes API to fetch Pod logs. When making requests to fetch Pod logs, you typically use the Kubernetes API endpoint for logs, which follows this general format:
GET /api/v1/namespaces/{namespace}/pods/{podName}/log

Here’s how you might use this API endpoint:
curl https://your-kubernetes-cluster/api/v1/namespaces/{namespace}/pods/{podName}/log

Replace {namespace} with the namespace of your Pod and {podName} with the name of your Pod.

To ensure that you’re getting the latest log content, you can add the follow parameter to the request URL. This parameter tells the server to stream the logs in real-time. Here’s the modified curl command:
curl https://your-kubernetes-cluster/api/v1/namespaces/{namespace}/pods/{podName}/log?follow=true

This command should ensure that you’re receiving the latest log content as it becomes available. If you’re using a browser to make the request, ensure that the URL includes the follow=true parameter as well.