generate/kube API endpoint sends Content-Type: application/x-tar instead of text/vnd.yaml
Issue Description
The GET /libpod/generate/kube endpoint (used by podman generate kube / podman kube generate, and callable directly via the libpod HTTP API) returns Kubernetes YAML but
labels it with the wrong Content-Type: application/x-tar instead of text/vnd.yaml.
This contradicts the endpoint's own swagger docs in pkg/api/server/register_kube.go:
// produces:
// - text/vnd.yaml
// - application/json
Root cause: the handler (pkg/api/handlers/libpod/generate.go) sends the YAML through the
shared utils.WriteResponse() helper, whose io.Reader branch hardcodes
application/x-tar it was built for the tar-streaming endpoints (image save/export,
podman cp) that are its other callers, and GenerateKube just reuses that path.
There's already a FIXME in generate.go calling this out, unresolved:
// FIXME: Content-Type is being set as application/x-tar NOT text/vnd.yaml
Any client that trusts the documented Content-Type to parse the response (e.g. an SDK generated from the swagger spec) will treat plain YAML text as a tar archive.
I've root-caused this and have a small patch ready a WriteResponseWithContentType helper alongside WriteResponse, so the other tar-streaming callers are untouched.
Steps to reproduce the issue
- Start the podman API service: podman system service --time=0 unix:///tmp/podman.sock &
- Create any container, e.g.: podman run -d --name test-gen alpine sleep 300
- Query the generate/kube endpoint directly and inspect the response headers: curl -i --unix-socket /tmp/podman.sock "http://d/v5.0.0/libpod/generate/kube?names=test-gen"
Describe the results you received
HTTP response headers include: Content-Type: application/x-tar
...while the response body is plain Kubernetes YAML text not a tar archive.
Describe the results you expected
Content-Type: text/vnd.yaml (or another appropriate text/YAML media type), matching the "produces: text/vnd.yaml" declared in this endpoint's own swagger documentation in pkg/api/server/register_kube.go.
podman info output
main branch,
version 6.2.0-dev, commit 7a6c0a0 (2026-08-28)
Podman version: 6.2.0-dev (main branch, commit 7a6c0a0, 2026-08-28)
unable to run verified this via source code
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
No response
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
/assign