---
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-integrate-with-machine-agents
---

# 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 integrate with machine agents

### [Prerequisites](https://charmhub.io/jenkins-k8s/docs/how-to-integrate-with-machine-agents#p-26782-prerequisites)

This guide assumes the `jenkins-k8s` charm to already be deployed on a k8s juju model `tutorial`.

To integrate machine (VM) agents, you’ll need to have a bootstrapped machine model. Learn about
bootstrapping different clouds
[here](https://documentation.ubuntu.com/juju/3.6/tutorial/#prepare-your-cloud).

Use `juju bootstrap localhost localhost` to bootstrap a `lxd` machine controller with the name
`localhost` for tutorial purposes.

Use `juju add-model tutorial` to add a model named `tutorial`.

### [Deploy Jenkins agents (VM)](https://charmhub.io/jenkins-k8s/docs/how-to-integrate-with-machine-agents#p-26782-deploy-jenkins-agents-vm)

Deploy 3 units of [jenkins agents](https://charmhub.io/jenkins-agent) on the lxd cloud.

```
# Deploy an edge version of the charm until stable version is released.
juju deploy jenkins-agent --channel=latest/edge -n3
```

### [Create an offer for cross model relation](https://charmhub.io/jenkins-k8s/docs/how-to-integrate-with-machine-agents#p-26782-create-an-offer-for-cross-model-relation)

To relate charms
[across different models](https://documentation.ubuntu.com/juju/3.6/howto/manage-relations/#add-a-cross-model-relation), a Juju
[`offer`](https://documentation.ubuntu.com/juju/3.6/howto/manage-offers/#integrate-with-an-offer) is
required.

Create an offer of the `jenkins-agent` charm’s `agent` relation.

```
juju offer jenkins-agent:agent
```

The output should look similar to the contents below:

```
Application "jenkins-agent" endpoints [agent] available at "admin/tutorial.jenkins-agent"
```

### [Relate Jenkins agents through the offer](https://charmhub.io/jenkins-k8s/docs/how-to-integrate-with-machine-agents#p-26782-relate-jenkins-agents-through-the-offer)

Switch back to the k8s model where `jenkins-k8s` charm is deployed. An example of the switch
command looks like the following: `juju switch microk8s-localhost:tutorial`.

Relate the agents to the `jenkins-k8s` server charm through the offer.
The syntax of the offer is as follows: `<controller>:<user>/<model>.<charm>`.

```
juju relate jenkins-k8s:agent localhost:admin/tutorial.jenkins-agent
```

---
