Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 84 additions & 45 deletions content/developer-platform/setup/ai-agent/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,78 +21,115 @@ The AI Agent is deployed using Helm. Follow these steps to install it:

### Prepare the Configuration

Create a `values.yaml` file with your specific configuration:
Create a `ai-agent.values.yaml` file with your specific configuration:

```yaml
aiAgent:
imagePullSecret: |
{
"quay.io": {}
"auths": {
"quay.io": {
"auth": "<PULL_CREDENTIALS>",
"email": ""
}
}
}

image:
repository: "quay.io/kubermatic/developer-platform-ai-agent"
tag: "v1.0.0" # Use the latest version or a specific version

config:
oidc_client_id: kdp-kubelogin # OIDC client ID for authentication
oidc_client_secret: "your-client-secret" # OIDC client secret
oidc_issuer: "https://your-oidc-provider" # URL of the OIDC provider
kubernetes_api_url: "https://your-kdp-api" # KDP API server URL
openai_api_key: "your-openai-api-key" # OpenAI API key for the language model
oidc:
clientID: kdp-kubelogin
clientSecret: <OIDC_CLIENT_SECRET>
issuerURL: https://login.<DOMAIN>
kubernetes_api_url: https://api.<DOMAIN>
openai_api_key: "<OPEN_API_KEY>" # OpenAI API key for the language model

ingress:
create: false
host: kdp.example.com # this should be main domain configured for KDP
class: nginx
scheme: https
prefix: /ai-agent(/|$)(.*)

# When scheme is set to "https", you either need to provide a TLS certificate
# yourself, or you can use the settings below to use cert-manager.
# certIssuer:
# # This needs to reference an _existing_ (Cluster)Issuer to provision
# # the TLS certificate for the protoboard.
# kind: ClusterIssuer
# name: letsencrypt-prod

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
create: true
host: ai-agent.<DOMAIN>
certIssuer:
kind: ClusterIssuer
name: letsencrypt-prod

```

Adjust the values according to your environment.
Before deploying the KDP dashboard, you need to replace the following placeholder variables in the `ai-agent.values.yaml` file with your own values:

* `<OPEN_API_KEY>`
* `<DOMAIN>`
* `<OIDC_CLIENT_SECRET>`

The `<OIDC_CLIENT_SECRET>` placeholder **must** be replaced with the value set in Dex and configured in the `dex.values.yaml` file.

### Install with Helm

Now that all placeholders are replaced, deploy the KDP AI Agent Helm chart.
To log into the Helm registry, use your email address as the username and the license key you received as the password.

```bash
$ helm registry login quay.io
$ helm upgrade --install kdp-ai-agent \
oci://quay.io/kubermatic/helm-charts/developer-platform-ai-agent \
--version=0.9.0 \
--create-namespace \
--namespace=kdp-system \
--values=ai-agent.values.yaml
```
helm upgrade \
--install \
--namespace <namespace> \ # if you are using an Issuer (namespaced), remember to use the same namespace here
--version <kdp_version> \
--values <your_values_path> \
--set-string "ai-agent.image.tag=v<kdp_version>" \
<release_name> <chart_path>

### Configure DNS record

You need to create a DNS record pointing to the load balancer of your Kubernetes cluster.

Create a DNS record that directs traffic from `ai-agent.<DOMAIN>` to your cluster's NGINX ingress controller.

Assuming you installed the NGINX ingress controller into the `ingress-nginx` namespace, use the following command to the retrieve the external IP address or DNS name of the load balancer (in column "EXTERNAL-IP"):

```bash
$ kubectl --namespace=ingress-nginx get service ingress-nginx-controller
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.47.248.232 4cdd93dfab834ed9a78858c7f2633380.eu-west-1.elb.amazonaws.com 80:30807/TCP,443:30184/TCP 449d
```

### Configure the Dashboard

To make the AI Agent accessible from the KDP Dashboard, you need to update the `values.yaml` file for your **dashboard deployment**. You'll need to set two environment variables within your dashboard's configuration.
To make the AI Agent accessible from the KDP Dashboard, you need to update the `values.yaml` file for your **dashboard deployment**. Assuming you followed the quickstart, this file would be `kdp-dashboard.values.yaml`.

First, enable the AI Agent feature in the UI by setting the environment variable `next_public_enable_generate_spec` to `"true"`.
You will need to edit it to activate the AI Agent feature and set the backend url.

Second, tell the frontend where the AI Agent backend is located by setting the environment variable `next_public_spec_generator_url` to your agent's URL (for example, `"https://kdp.example.com/ai-agent/"`).

**Important:** To avoid CORS errors, the URL for `next_public_spec_generator_url` must use the same host as your main KDP dashboard (and in general the main kdp domain). The path (`/ai-agent/` in this example) must also match the `ingress.prefix` you configured in the AI Agent's `values.yaml` in Step 1.
```yaml
dashboard:
config:
features:
aiAgent:
enabled: true
generatorURL: ai-agent.<DOMAIN>
```


You'll need to replace `<DOMAIN>`.

Then after this update the release of your kdp dashboard. If you followed the Quickstart it will be called `kdp-dashboard` in the `kdp-system` namespace, so the command would look like this to first login and then update:

```bash
$ helm registry login quay.io
$ helm upgrade --install kdp-dashboard \
oci://quay.io/kubermatic/helm-charts/developer-platform-dashboard \
--version=0.9.0 \
--create-namespace \
--namespace=kdp-system \
--values=kdp-dashboard.values.yaml
```

After this you will need to delete the pod for the dashboard manually for it to be redeployed and pick up the new values. You can find them by the label `app.kubernetes.io/name: kdp-dashboard` and delete with.

```bash
kubectl delete pods -l app.kubernetes.io/name=kdp-dashboard -n kdp-system
```

### Verify the Installation

Once the pod is running, you can use it in the frontend.
Once the pods start, you can use the AI Agent in the frontend.

A purple button should be visible in the form to create a new service object within a workspace.

Expand All @@ -108,4 +145,6 @@ After a few seconds you should get the result:

![AI Agent response](ai-agent-example-response.png)

You can then edit and modify if you like. You also do not have to worry about getting a wrong schema since it is getting validated in the backend. You can be sure there are no hallucinated fields nor missing required fields.
You can then edit and modify if you like, from the form or directly in the YAML.

You also do not have to worry about getting a wrong schema since it is getting validated in the backend. You can be sure there are no hallucinated fields nor missing required fields.
5 changes: 5 additions & 0 deletions content/developer-platform/setup/quickstart/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,8 @@ After logging in, you will be taken to the KDP dashboard, where you can begin ex
[k8s/docs/tools/installation]: https://kubernetes.io/docs/tasks/tools/#kubectl
[kcp/chart/readme]: https://github.com/kcp-dev/helm-charts/tree/main/charts/kcp
[kubelogin/src/readme]: https://github.com/int128/kubelogin


### Extensions

If you want to install the KDP AI Agent, which helps you generate yaml files for resources from descriptions in natural language, follow [these instructions](../ai-agent/_index.en.md).