# Adding Shared Hosts

Shared Hosts allow workloads to run on the same set of virtual machines (VMs), making better use of resources across multiple Tenants. DuploCloud now supports Services, Jobs, and CronJobs on shared Hosts, providing more flexibility for running long-running services, batch jobs, and scheduled tasks.

DuploCloud supports shared Hosts for:

* **Services**
* **Jobs**
* **CronJobs**

## Configuring Tenants to allow Host sharing

To enable Host sharing, configure one Tenant to share its Hosts, and another Tenant to run K8s Pods on any Host.

### Enabling a Tenant to share its Hosts

1. In the DuploCloud Portal, navigate to **Administrator** -> **Tenant**.
2. From the **Tenant** list box, select the Tenant that will share its Host.
3. Click the **Settings** tab.
4. Click **Add**. The **Add Tenant Feature** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F94caP5s0LOdXkC2L0i2J%2FAddfeature1.jpg?alt=media&#x26;token=48c3fa4b-15a2-432b-90f4-e7559571456c" alt="" width="455"><figcaption><p>The <strong>Add Tenant Feature</strong> pane</p></figcaption></figure></div>
5. From the **Select Feature** item list, select **Allow hosts to run K8S pods from other tenants**.
6. Select **Enable.**
7. Click **Add**. This Tenant's Hosts can now run Pods from other Tenants.

### **Enabling a Tenant to run Pods on shared Hosts**

1. In the DuploCloud Portal, navigate to **Administrator** -> **Tenant**.
2. From the **Tenant** list, select the Tenant that will run Pods on the shared Host.
3. Select the **Settings** tab.
4. Click **Add**. The **Add Tenant Feature** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FGDWdUdRMogmTtD1257FM%2FSHARED.jpg?alt=media&#x26;token=38257e81-f98e-48f2-8a33-1824e742e33f" alt="" width="455"><figcaption><p><strong>Add Tenant Feature</strong> pane</p></figcaption></figure></div>
5. From the **Select Feature** item list, select **Enable option to run K8S pods on any host**.
6. Select **Enable.**
7. Click **Add**. This Tenant can now run Pods on other Tenant's Hosts.

## Creating Services, Jobs, and CronJobs on Shared Hosts

After configuring Tenant settings to allow Host sharing, create the resources you want to run on the shared Hosts.

### **Creating a Service to run on a shared Host**

1. From the **Tenant** list box, select the Tenant that will run Pods on the shared Host.
2. In the DuploCloud Portal, navigate to **Kubernetes** -> **Services**.
3. In the **Services** tab, click **Add**. The **Add Service** page displays.<br>

   <figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FAFmtSyQHMCmxBvVdvyfh%2Fscreenshot-nimbusweb.me-2024.02.18-13_00_08.png?alt=media&#x26;token=46324d9c-1f88-447a-9e63-ad3093a7f620" alt=""><figcaption><p>The filled <strong>Add Service</strong> page, Basic Options.</p></figcaption></figure>
4. Fill in the **Service Name**, **Cloud**, **Platform**, and **Docker Image** fields. Click **Next**.
5. Enable **Run on Any Host**.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FnY0ORfXEsApFG48gaKxz%2Fimage.png?alt=media&#x26;token=8f37e1a1-a6a9-4cd3-90f8-96a4d60f2749" alt=""><figcaption><p>The filled <strong>Add Service</strong> page, Advanced Options.</p></figcaption></figure></div>
6. Click **Create**. A Service running on the shared Host is created.

### **Creating a Job or CronJob to run on a Shared Host**

DuploCloud supports running Jobs and CronJobs on shared Hosts for AWS.

1. Follow the steps in the DuploCloud documentation to create a [Kubernetes Job](https://docs.duplocloud.com/docs/kubernetes-overview/jobs#creating-a-kubernetes-job-in-the-duplocloud-portal) or [Kubernetes CronJob](https://docs.duplocloud.com/docs/kubernetes-overview/cronjobs#creating-a-kubernetes-cronjob-in-the-duplocloud-portal).
2. On the **Add Kubernetes Job** or **Add Kubernetes CronJob** page, enable **Run on Any Host**.
3. Click **Create** to deploy the Job or CronJob on the shared Host.

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FIQ99E3V0NHMcCAMas5GR%2FScreenshot%20(119).png?alt=media&#x26;token=bb2b734e-ef5e-49ae-b64e-0da37e851c5c" alt=""><figcaption><p>The <strong>Add Kubernetes Job</strong> page with the <strong>Run on Any Host</strong> option enabled</p></figcaption></figure>
