-
Notifications
You must be signed in to change notification settings - Fork 40
Doc updates #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Doc updates #282
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
src/app/docs/kagent/operations/operational-considerations/page.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| --- | ||
| title: "Operational considerations" | ||
| pageOrder: 1 | ||
| description: "Important operational considerations when running kagent in production." | ||
| --- | ||
|
|
||
| export const metadata = { | ||
| title: "Operational Considerations", | ||
| description: "Important operational considerations when running kagent in production.", | ||
| author: "kagent.dev" | ||
| }; | ||
|
|
||
| # Operational considerations | ||
|
|
||
| Review the following operational considerations when running kagent in production environments, including database configuration, high availability, and secret management. | ||
|
|
||
| ## Automatic agent restart on secret updates | ||
|
|
||
| Kagent automatically restarts agents when you update the secrets that the agents reference. This restart ensures that agents pick up new API keys, TLS certificates, and other secret values without manual intervention. | ||
|
|
||
| The following secret updates trigger automatic agent restarts: | ||
|
|
||
| - **API keys**: Secrets referenced in `ModelConfig` resources (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`) | ||
| - **TLS certificates**: Secrets referenced in `ModelConfig` TLS configuration (e.g., CA certificates) | ||
| - **Environment variables**: Any secrets referenced via `secretKeyRef` in agent deployment specifications | ||
|
|
||
| ## Leader election when controller is scaled | ||
|
|
||
| When you scale the kagent controller to multiple replicas for high availability, leader election is automatically enabled. This ensures that only one controller instance actively reconciles resources at a time, preventing conflicts and duplicate operations. | ||
|
|
||
| ### Leader election scenarios | ||
|
|
||
| - **Single replica**: No leader election needed; the single controller instance handles all operations | ||
| - **Multiple replicas**: Leader election is automatically enabled when `controller.replicas > 1` | ||
| - **Active leader**: Only the elected leader performs reconciliation operations | ||
| - **Standby replicas**: Other replicas remain ready but do not perform reconciliation until they become the leader | ||
artberger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Enable high availability | ||
|
|
||
| You can set the number of controller replicas to enable high availability. | ||
|
|
||
| **Helm `--set` flag:** | ||
|
|
||
| ```bash | ||
| helm upgrade kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \ | ||
| --namespace kagent \ | ||
| --set controller.replicas=3 | ||
| ``` | ||
|
|
||
| **Helm values file:** | ||
|
|
||
| ```yaml | ||
| controller: | ||
| replicas: 3 | ||
| ``` | ||
| ### More considerations for HA | ||
| - **Database requirement**: When using multiple controller replicas, you must use PostgreSQL as the database backend. SQLite cannot be used with multiple replicas (see [SQLite database scaling limitation](#sqlite-database-scaling-limitation)). | ||
| - **Leader election**: Leader election uses Kubernetes leases and is handled automatically. | ||
| - **Failover**: If the leader fails, another replica automatically becomes the leader. | ||
| ## SQLite database scaling limitation | ||
| SQLite is the default database for kagent and works well for single-replica controller deployments. However, SQLite cannot be used when scaling the controller to multiple replicas. | ||
| SQLite is a file-based database that does not support concurrent writes from multiple processes. When you scale the controller to multiple replicas, each replica would try to access the same SQLite database file, causing conflicts and potential data corruption. | ||
artberger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| If you try to scale the controller with SQLite enabled, you see an error during Helm installation or upgrade: | ||
| ```bash | ||
| Error: cannot scale controller with SQLite database | ||
| ``` | ||
| ### Use PostgreSQL for scaling | ||
| To scale the controller to multiple replicas, you must configure PostgreSQL as the database backend. You can enable PostgreSQL by using the Helm `--set` flag or values file. | ||
|
|
||
| **Helm `--set` flag:** | ||
|
|
||
| ```bash | ||
| helm upgrade kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \ | ||
| --namespace kagent \ | ||
| --set database.type=postgres \ | ||
| --set database.postgres.url=postgres://user:password@postgres-host:5432/kagent \ | ||
| --set controller.replicas=3 | ||
| ``` | ||
|
|
||
| **Helm values file:** | ||
|
|
||
| ```yaml | ||
| database: | ||
| type: postgres | ||
| postgres: | ||
| url: postgres://user:password@postgres-host:5432/kagent | ||
|
||
| controller: | ||
| replicas: 3 | ||
artberger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ### Migrate from SQLite to PostgreSQL | ||
|
|
||
| If you're currently using SQLite and want to scale the controller, consider the following steps. | ||
|
|
||
| 1. Backup your data as needed, such as by copying the SQLite database file to a backup location. | ||
|
|
||
| ```bash | ||
| kubectl exec -n kagent deployment/kagent-controller -c controller -- \ | ||
| sqlite3 /var/lib/kagent/kagent.db .dump > backup.sql | ||
| ``` | ||
|
|
||
| 2. Set up PostgreSQL by: | ||
| - Installing PostgreSQL in your cluster; or | ||
| - Using a managed PostgreSQL service. | ||
|
|
||
| 3. Update your Helm values to use PostgreSQL. | ||
| ```yaml | ||
| database: | ||
| type: postgres | ||
| postgres: | ||
| url: postgres://user:password@postgres-host:5432/kagent | ||
| ``` | ||
|
|
||
| 4. Upgrade the Helm release. | ||
| ```bash | ||
| helm upgrade kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \ | ||
| --namespace kagent \ | ||
| -f values.yaml | ||
| ``` | ||
|
|
||
| 5. Scale the controller. | ||
| ```bash | ||
| helm upgrade kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \ | ||
| --namespace kagent \ | ||
| -f values.yaml \ | ||
| --set controller.replicas=3 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.