# Restarting Agents

Connectware agents run as containerized workloads, which are managed by your chosen deployment method (Docker or Kubernetes). Agent restarts are performed outside of Connectware using standard platform tools.

Restarting an agent can be necessary if the agent becomes unresponsive, loses connectivity, or needs to reload its configuration.

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

### Restarting Agents on Kubernetes

#### Restarting a Single Agent

Use this if you want to restart a single agent.

{% code lineNumbers="true" %}

```bash
kubectl rollout restart statefulset ${STATEFULSET_NAME} -n ${NAMESPACE}
```

{% endcode %}

{% hint style="info" %}
Replace `${STATEFULSET_NAME}` with your agent StatefulSet name and `${NAMESPACE}` with your namespace.
{% endhint %}

#### Restarting All Agents from a `connectware-agent` Installation

Use this if you want to restart all agents managed by one `connectware-agent` installation.

{% code lineNumbers="true" %}

```bash
kubectl rollout restart statefulset -l app.kubernetes.io/instance=${INSTALLATION_NAME} -n ${NAMESPACE}
```

{% endcode %}

{% hint style="info" %}
Replace `${INSTALLATION_NAME}` with your Helm release name and `${NAMESPACE}` with your namespace.
{% endhint %}

**Result**

After restarting, your agent will automatically reconnect to Connectware once the pod is running again. Restarting an agent does not affect other agents or the Connectware core system.

**Troubleshooting**

If your agent does not reconnect after a restart, check the pod/container logs for errors and ensure network connectivity to Connectware.
{% endtab %}

{% tab title="Docker" %}

### Restarting Agents with Docker

If the agent is running as a Docker container, you can restart it with:

{% code lineNumbers="true" %}

```bash
docker restart ${CONTAINER_NAME}
```

{% endcode %}

{% hint style="info" %}
Replace `${CONTAINER_NAME}` with the name of the agent container that you want to restart.
{% endhint %}

**Result**

After restarting, the agent will automatically reconnect to Connectware once the container or pod is running again.
{% endtab %}
{% endtabs %}

## Additional Resources

For platform-specific details, see the official documentation:

* Docker: <https://docs.docker.com/>
* Kubernetes: <https://kubernetes.io/docs/>


---

# Agent Instructions: 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 current page URL with the `ask` query parameter:

```
GET https://docs.cybus.io/2-1-2/documentation/agents/restarting-agents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
