> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/solutions/kubectl-exec-is-timed-out-after-4-hours.md).

# Kubectl Exec Times Out After 4 Hours

## Problem

The \*\*`kubectl exec` \*\*command is timing out after exactly 4 hours.

Below is the output of the default config map:

{% tabs %}
{% tab title="None" %}

```none
$ kubectl describe cm worker-default-kubelet-config -n kube-system
Name:        worker-default-kubelet-config
Namespace:    kube-system
Labels:      <none>
Annotations:  <none>

Data
====
kubelet:
----
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
address: 0.0.0.0
authentication:
  anonymous:
    enabled: false
  webhook:
    enabled: true
  x509:
    clientCAFile: "/etc/pf9/kube.d/certs/kubelet/server/ca.crt"
authorization:
  mode: AlwaysAllow
clusterDNS:
- "10.21.0.10"
clusterDomain: "cluster.local"
featureGates:
  PodPriority: true
  DynamicKubeletConfig: true
maxPods: 200
readOnlyPort: 0
tlsCertFile: "/etc/pf9/kube.d/certs/kubelet/server/request.crt"
tlsPrivateKeyFile: "/etc/pf9/kube.d/certs/kubelet/server/request.key"

Events:  <none>
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed Kubernetes - All Versions

## Cause

The value for *streaming-connection-idle-timeout* parameter is not set in Kubelet configuration which is responsible for the maximum time a streaming connection can be idle before the connection is automatically closed. The value **"0"** indicates no timeout. As the value is not defined the command **kubectl exec** is timing out after 4 hours.

## Resolution

Update the configmap and set the value of **streamingConnectionIdleTimeout** and verify if the change is successful.

{% tabs %}
{% tab title="None" %}

```none
# kubectl edit cm worker-default-kubelet-config -n kube-system

# kubectl describe cm worker-default-kubelet-config -n kube-system | grep "streamingConnectionIdleTimeout"
streamingConnectionIdleTimeout: "672h"
```

{% endtab %}
{% endtabs %}

## Additional Information

Refer the Dynamic [Kubelet Configuration](https://docs.platform9.com/kubernetes/dynamic-kubelet-configuration) for more information.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmk/solutions/kubectl-exec-is-timed-out-after-4-hours.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
