> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/latest/configuration/security_context.md).

# Security context configuration

Using the TPOSS Helm chart, you can configure certain Linux kernel parameters through the **securityContext** configuration option. One of the most important use cases for setting [sysctls](https://man7.org/linux/man-pages/man8/sysctl.8.html) is to adjust TCP keepalive timeouts. Setting these parameters can be useful to detect lost connections towards the [TPOSS database](https://docs.cennso.com/components/tposs/latest/configuration/db.md) as fast as possible to avoid unnecessary resource consumption. These configuration options are responsible for the TCP keepalive timeouts:

- `net.ipv4.tcp_keepalive_time` - the interval in seconds between the last data packet sent and the first keepalive message.
- `net.ipv4.tcp_keepalive_intvl` - the interval in seconds between the subsequent keepalive messages.
- `net.ipv4.tcp_keepalive_probes` - the number of keepalive messages to send before considering the connection is lost.

The default system value for the `net.ipv4.tcp_keepalive_time` is 2 hours, which is too long if you want to quickly detect lost connections to the database. It is recommended to reduce it to a value lower than the value of the **database.timeout** configuration option. You can configure these parameters using the following configuration options:

```yaml
securityContext:
  sysctls:
    - name: net.ipv4.tcp_keepalive_time
      value: "5"
    - name: net.ipv4.tcp_keepalive_intvl
      value: "5"
    - name: net.ipv4.tcp_keepalive_probes
      value: "1"
```

> [!NOTE]
> Only [safe sysctls](https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/#safe-and-unsafe-sysctls) can be configured, due to Kubernetes policies that restrict the use of potentially unsafe system-level settings.
