> For the complete documentation index, see [llms.txt](https://datasherlock.gitbook.io/datasherlock/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://datasherlock.gitbook.io/datasherlock/admin/kubernetes.md).

# Kubernetes

Learn how to deploy Datasherlock on a Kubernetes cluster seamlessly. Follow these steps to set up and configure Datasherlock for your Kubernetes environment

<figure><img src="https://datasherlock.io/assets/images/k8s.gif" alt=""><figcaption></figcaption></figure>

### Setup Kubernetes <a href="#setup-kubernetes" id="setup-kubernetes"></a>

If you don't already have a Kubernetes cluster like EKS, GKE, or AKS, you can create one using Kind:

```bash
kind create cluster
```

### Register Database Metadata with Datasherlocks <a href="#register-database-metadata-with-datasherlocks" id="register-database-metadata-with-datasherlocks"></a>

You can register your database's metadata with Datasherlocks. Below is an example configuration for MySQL:

```yaml
type: "<DB_TYPE>"
database:
  host: "<DB_HOST>"
  username: "<DB_USERNAME>"
  port: "<DB_PORT>"
  database: "<DB_NAME>"
  ssl: "<DB_SSL>"
```

Use the following command to register an agent with the Datasherlocks cloud. It will provide you with a token and a remote link. Make sure to keep these credentials secure:

```bash
sherlock register --config config.yaml --name <AGENT_NAME>
```

### Create `values.yaml` <a href="#create-valuesyaml" id="create-valuesyaml"></a>

```yaml
config:
  type: "mysql"
  database:
    host: "YOUR_DB_HOST"
    username: "YOUR_DB_USER"
    port: "YOUR_DB_PORT"
    database: "YOUR_DB_NAME"
    ssl: false
```

### Deploy a agent on production <a href="#deploy-a-agent-on-production" id="deploy-a-agent-on-production"></a>

Deploy the agent on production using Helm. First, add the Datasherlocks Helm repository:

```bash
helm repo add datasherlock https://datasherlocks.github.io/sherlock
```

Then, install the MySQL agent with the following command, providing the necessary parameters:

```bash
helm install mysql-agent datasherlock/sherlock -n agent --set tunnelToken=***** -f values.yaml --set db_password=**** --set apiKey=*****
```

#### SSO Config <a href="#sso-config" id="sso-config"></a>

**Create `values.yaml`**

```yaml
config:
  type: "mysql"
  database:
    host: "YOUR_DB_HOST"
    username: "YOUR_DB_USER"
    port: "YOUR_DB_PORT"
    database: "YOUR_DB_NAME"
    ssl: false
  oauth:
    client_id: "client_id"
    scopes: ["openid", "profile", "email"]
    provider: "https://accounts.google.com"
```

### Upgrade helm deployment <a href="#upgrade-helm-deployment" id="upgrade-helm-deployment"></a>

```bash
helm upgrade mysql-agent datasherlock/sherlock -n agent --set tunnelToken=***** -f values.yaml --set db_password=**** --set apiKey=***** --set clientSecret=****
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://datasherlock.gitbook.io/datasherlock/admin/kubernetes.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.
