> ## Documentation Index
> Fetch the complete documentation index at: https://doc.qbilon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Kubernetes

> Configure the Kubernetes connector and its connection settings.

## Configuration

During the first setup step, users can select the name of the automation as well as the name of the new task.

In the second step `Data Source Settings`, the URL of the Kubernetes API server must be provided together with the API access token as well as the name of the according Kubernetes cluster.

## Obtaining the API Token

Follow these steps to determine the necessary access token:

1. Open a terminal or command prompt and navigate to the directory where you want to create the Qbilon configuration file.
2. Create a new file named `qbilon-config.yaml` and open it in a text editor.
3. Copy the following content into the `qbilon-config.yaml` file:
   ```yaml theme={null}
   ---
   # Source: qbilon-k8s-task/templates/serviceaccount.yaml
   apiVersion: v1
   kind: ServiceAccount
   metadata:
     name: qbilon-cluster-reader
     namespace: default
   ---
   # Source: qbilon-k8s-task/templates/role.yml
   apiVersion: rbac.authorization.k8s.io/v1
   kind: ClusterRole
   metadata:
     name: qbilon-cluster-reader-role
   rules:
     - apiGroups: [ "" ]
       resources: [ "namespaces" ]
       verbs: [ "get", "watch", "list" ]
   ---
   # Source: qbilon-k8s-task/templates/role.yml
   apiVersion: rbac.authorization.k8s.io/v1
   kind: ClusterRoleBinding
   metadata:
     name: qbilon-cluster-reader-role-binding
   subjects:
     - kind: ServiceAccount
       name: qbilon-cluster-reader
       namespace: default
   roleRef:
     kind: ClusterRole
     name: qbilon-cluster-reader-role
     apiGroup: rbac.authorization.k8s.io
   ```
4. Save the `qbilon-config.yaml` file.
5. In the terminal or command prompt, navigate to the directory where you saved the `qbilon-config.yaml` file.
6. Execute the following command to apply the configuration to your Kubernetes cluster:

`kubectl apply -f qbilon-config.yaml`

7. Once the configuration is applied successfully, execute the following command to create a token for the qbilon-service-account:

`kubectl create token qbilon-cluster-reader --duration=999999h`

8. This command generates a token for the `qbilon-cluster-reader`, and the `--duration=999999h` flag sets the token validity to a long duration (999999 hours in this example).
9. The token is now generated and can be used to authenticate qbilon with the Kubernetes cluster. Also, the public URL of the Kubernetes control plane is required.

### Clean-up

If you no longer require the Qbilon connection and want to remove the associated resources, just follow these steps:

1. Open a terminal or command prompt.
2. Execute the following command to delete the Qbilon namespace: `kubectl delete namespace qbilon`.
3. This command deletes the namespace along with all the resources created within it, including the service account, role, and role binding.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.