# Attach Runbook Hub to Cluster

A hub can be attached to one or more clusters. When a hub is attached to a cluster, gopaddle filters the Kubernetes resources and events in the cluster matching the selectors across all the runbooks within the hub. The filtered resources and events are then annotated with the runbook information.

### Prerequisite to test Runbooks with a sample application

To test the runbook functionality,&#x20;

a) create a sample repository in your GitHub Account and initialize a `.gp.yaml` file. Check the [runbook hub section](/overview/runbook-hub.md) to learn more about initializing a repository as a Hub.&#x20;

b) [Register the source control account](/overview/register-github-account.md) and make sure the Runbook Hub is discovered.

c) Deploy the below sample application such that we have a application that matches the selectors in the Runbook Hub.

<details>

<summary>Sample Application to create an Event</summary>

For the purpose of testing, a sample Pod with ImagePullBackOff can be deployed by applying the yaml below:

```sh
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
  name: demo-1
---
apiVersion: v1
kind: Pod
metadata:
  name: image-pull-failure-pod
  namespace: demo-1
  labels:
    app: image-pull-failure-pod
spec:
  containers:
  - name: image-error-container
image: non-existent-image:latest # This image intentionally does not exist
EOF
```

</details>

### Steps to attach Hub to a Cluster

1. In the left navigation panel, select **Runbook Hubs**.&#x20;
2. Click on a Runbook Hub to view the Runbook Hub
3. Click on the attach icon <img src="https://lh7-us.googleusercontent.com/LdmdTGTeHRvsg8pD9Eqwm_nIlsMJsMP3xmrKNb7ZXoBbeGNtXCw4wPxk0rvr17RtJszo0wym8ijojeNJPJphVNBR0lw6ZMmvy_8XtsNSdsgm9JpmOhBtMAhQjLRwAbz3BnyFOPTxF7nyMKtuiZsGyi0" alt="" data-size="line"> under the **Clusters** section
4. In the popup choose the localhost cluster and select **Attach**

<figure><img src="https://lh7-us.googleusercontent.com/oOoD0gBLRDD9ffgg_GjxDjwnokARvjQcM4lstg6bflCDERPStQ31VRAhzVF8xsBcc9HIbaLXOHR0n3ycCoo6crhDlImJxZYPobHcWD06ng9BSwkhWa7FIPCF9kFJllV6J3bTix-9jt_Gip5GFkmZ-dA" alt=""><figcaption><p>Select the cluster to attach</p></figcaption></figure>

5. Navigate to the **Clusters** section in the left navigation panel and click on the cluster name to view the cluster
6. All the runbook hubs associated with the cluster can be viewed under the **Runbook Hubs** section.

<figure><img src="https://lh7-us.googleusercontent.com/pijdKd2j4RoQ3SlAeimoBUqVrfCGQXG1F_9IEoxFDc8-md4qbCDbH_5rJQP5vBY0xIx0WT7FPOP5RRqNM_r4rhu9matR2f0GUikDAk1ynDukZcpZ00DFRlRtjqEd8NI_uCP9QcXVnX_jcEtNn_x4few" alt=""><figcaption><p>List of Runbook Hubs in Cluster Page</p></figcaption></figure>

6. Click on **View -> Resources** to list all the resources discovered under the cluster
7. Choose the **List filtered resources with runbooks** to view the resources tagged with runbooks. The demo pending Pod gets listed with a runbook icon.

<figure><img src="https://lh7-us.googleusercontent.com/GjWKeBdtcolK1LhBYnVODdqcxEwwRaiVCuvHw0Q1r7pfZ4L_c5SxOjxy7dCSUkQqmYJErMTsmbAS6-ZJ3NTBkrm7XWM-IDcLaWmb8-GLvdpFi7yaNqu-EXq_hbE3zMiBmrNhq5JHPMDAT39AMXK2X-Y" alt=""><figcaption><p>View Filtered Resources with Runbooks</p></figcaption></figure>

8. Click on the runbook icon to view the runbook.

<figure><img src="/files/uChGLjtFh8e2fUd2FPrl" alt=""><figcaption><p>Cluster View Runbook Attached to Resource</p></figcaption></figure>


---

# 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://help.gopaddle.io/overview/runbook-hub/attach-runbook-hub-to-cluster.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.
