---
title: Charmhub | Deploy Jenkins K8s using Charmhub - The Open Operator Collection
description: Deploy the latest version of Jenkins K8s as a Kubernetes Operator on
  any cloud.
url: https://charmhub.io/jenkins-k8s/docs/how-to-configure-jenkins-memory-usage
---

# Jenkins K8s

[Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")

* [Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")

Platform:

stable 201

```
juju deploy jenkins-k8s
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Contacts

* [Submit a bug](https://github.com/canonical/jenkins-k8s-operator/issues)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

# How to control heap memory

The [jenkins-k8s-operator](https://github.com/canonical/jenkins-k8s-operator) charm uses [Juju constraints](https://juju.is/docs/juju/constraint) to limit the amount of memory a charm can use. To deploy the charm with constraints, use the `--constraints "<key>=<value>"` option when running `juju deploy`:

```
juju deploy jenkins-k8s --channel=latest/edge --constraints "mem=2048M"
```

To change this value after deployment, use the `set-constraints` command.

```
juju set-constraints jenkins-k8s "mem=4096M"
```

Other types of constraints (like cores, disk, etc.) can also be applied. Note that this value affects the shared maximum memory between the `charm` container and `jenkins` container.

## [Considerations when applying memory constraints](https://charmhub.io/jenkins-k8s/docs/how-to-configure-jenkins-memory-usage#p-31257-considerations-when-applying-memory-constraints)

Constraints set this way directly influence the amount of heap memory available to the JVM, with a ratio `JVM heap / Container Memory limit` of 0.5. For example, a `jenkins-k8s-operator` charm deployed with `--constraints "mem=1024M"` would set a maximum heap memory size of 512Mb. Too little heap memory can result in the controller getting restarted due to Out-of-memory (OOM) error. Make sure to adapt the memory constraints based on your workload.

---
