# Autonomous Agent for Kubernetes
Autonomous Agent for Kubernetes powered by OpenAI.
Features:
- Autonomous Kubernetes cluster operations using LLM Agents powered by ChatGPT (GPT-3.5, GPT-4 and future versions).
- Diagnose and analyze the potential issues for Kubernetes workloads.
- Generate the Kubernetes manifests based on the provided prompt instructions.
- Utilize native kubectl and trivy commands for Kubernetes cluster access and security vulnerability scanning.
## Install
### Install locally
Install the copilot with pip command below:
```sh
pip install kube-agent
```
**Setup:**
- Ensure [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) is installed on the local machine and the kubeconfig file is configured for Kubernetes cluster access.
- Install [`trivy`](https://github.com/aquasecurity/trivy) to assess container image security issues (for the `audit` command).
- Set the OpenAI [API key](https://platform.openai.com/account/api-keys) as the `OPENAI_API_KEY` environment variable to enable ChatGPT functionality.
- For [Azure OpenAI service](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api#retrieve-key-and-endpoint), please set ` AZURE_OPENAI_API_KEY=<key>` and `AZURE_OPENAI_ENDPOINT=https://<replace-this>.openai.azure.com/`.
### Run in Kubernetes
```sh
kubectl run -it --rm copilot \
--env="OPENAI_API_KEY=$OPENAI_API_KEY" \
--restart=Never \
--image=ghcr.io/feiskyer/kube-agent \
-- execute --verbose 'What Pods are using max memory in the cluster'
kubectl run -it --rm copilot \
--env="AZURE_OPENAI_API_KEY=$AZURE_OPENAI_API_KEY" \
--env="AZURE_OPENAI_ENDPOINT=$AZURE_OPENAI_ENDPOINT" \
--restart=Never \
--image=ghcr.io/feiskyer/kube-agent \
-- execute --verbose 'What Pods are using max memory in the cluster'
```
Refer [kubernetes.md](kubernetes.md) for more detailed steps.
## How to use
Running directly in the terminal:
```sh
Usage: kube-agent [OPTIONS] COMMAND [ARGS]...
Kubernetes Copilot powered by OpenAI
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
analyze analyze issues for a given resource
audit audit security issues for a Pod
diagnose diagnose problems for a Pod
execute execute operations based on prompt instructions
generate generate Kubernetes manifests
```
## Contribution
The project is opensource at github [feiskyer/kube-agent](https://github.com/feiskyer/kube-agent) with Apache License.
If you would like to contribute to the project, please follow these guidelines:
1. Fork the repository and clone it to your local machine.
2. Create a new branch for your changes.
3. Make your changes and commit them with a descriptive commit message.
4. Push your changes to your forked repository.
5. Open a pull request to the main repository.
Raw data
{
"_id": null,
"home_page": "https://github.com/feiskyer/kube-agent",
"name": "kube-agent",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.11",
"maintainer_email": null,
"keywords": "kubernetes, copilot, openai, chatgpt, agent, autogen",
"author": "Pengfei Ni",
"author_email": "feiskyer@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9e/90/0f28dfb8097a0abf577179822384e5d863858087025bd40945a19ec89893/kube_agent-0.1.1.tar.gz",
"platform": null,
"description": "# Autonomous Agent for Kubernetes\n\nAutonomous Agent for Kubernetes powered by OpenAI.\n\nFeatures:\n\n- Autonomous Kubernetes cluster operations using LLM Agents powered by ChatGPT (GPT-3.5, GPT-4 and future versions).\n- Diagnose and analyze the potential issues for Kubernetes workloads.\n- Generate the Kubernetes manifests based on the provided prompt instructions.\n- Utilize native kubectl and trivy commands for Kubernetes cluster access and security vulnerability scanning.\n\n## Install\n\n### Install locally\n\nInstall the copilot with pip command below:\n\n```sh\npip install kube-agent\n```\n\n**Setup:**\n\n- Ensure [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) is installed on the local machine and the kubeconfig file is configured for Kubernetes cluster access.\n- Install [`trivy`](https://github.com/aquasecurity/trivy) to assess container image security issues (for the `audit` command).\n- Set the OpenAI [API key](https://platform.openai.com/account/api-keys) as the `OPENAI_API_KEY` environment variable to enable ChatGPT functionality.\n - For [Azure OpenAI service](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api#retrieve-key-and-endpoint), please set ` AZURE_OPENAI_API_KEY=<key>` and `AZURE_OPENAI_ENDPOINT=https://<replace-this>.openai.azure.com/`.\n\n\n### Run in Kubernetes\n\n```sh\nkubectl run -it --rm copilot \\\n --env=\"OPENAI_API_KEY=$OPENAI_API_KEY\" \\\n --restart=Never \\\n --image=ghcr.io/feiskyer/kube-agent \\\n -- execute --verbose 'What Pods are using max memory in the cluster'\n\nkubectl run -it --rm copilot \\\n --env=\"AZURE_OPENAI_API_KEY=$AZURE_OPENAI_API_KEY\" \\\n --env=\"AZURE_OPENAI_ENDPOINT=$AZURE_OPENAI_ENDPOINT\" \\\n --restart=Never \\\n --image=ghcr.io/feiskyer/kube-agent \\\n -- execute --verbose 'What Pods are using max memory in the cluster'\n```\n\nRefer [kubernetes.md](kubernetes.md) for more detailed steps.\n\n## How to use\n\nRunning directly in the terminal:\n\n```sh\nUsage: kube-agent [OPTIONS] COMMAND [ARGS]...\n\n Kubernetes Copilot powered by OpenAI\n\nOptions:\n --version Show the version and exit.\n --help Show this message and exit.\n\nCommands:\n analyze analyze issues for a given resource\n audit audit security issues for a Pod\n diagnose diagnose problems for a Pod\n execute execute operations based on prompt instructions\n generate generate Kubernetes manifests\n```\n\n## Contribution\n\nThe project is opensource at github [feiskyer/kube-agent](https://github.com/feiskyer/kube-agent) with Apache License.\n\nIf you would like to contribute to the project, please follow these guidelines:\n\n1. Fork the repository and clone it to your local machine.\n2. Create a new branch for your changes.\n3. Make your changes and commit them with a descriptive commit message.\n4. Push your changes to your forked repository.\n5. Open a pull request to the main repository.\n",
"bugtrack_url": null,
"license": null,
"summary": "Kubernetes Copilot",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/feiskyer/kube-agent",
"Repository": "https://github.com/feiskyer/kube-agent"
},
"split_keywords": [
"kubernetes",
" copilot",
" openai",
" chatgpt",
" agent",
" autogen"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e119eb3d185ed2f4c871f1bd7c641f40d0535e51b9f1c271ad1aaea52dffe8fd",
"md5": "79a8416a43b91ed1a9b74cf7896b0b32",
"sha256": "43cae93e3f8fb72233285e926b22c3e4e2d3f5e4f7b1230ffa439db22135321a"
},
"downloads": -1,
"filename": "kube_agent-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "79a8416a43b91ed1a9b74cf7896b0b32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.11",
"size": 19318,
"upload_time": "2024-05-07T02:08:40",
"upload_time_iso_8601": "2024-05-07T02:08:40.847243Z",
"url": "https://files.pythonhosted.org/packages/e1/19/eb3d185ed2f4c871f1bd7c641f40d0535e51b9f1c271ad1aaea52dffe8fd/kube_agent-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e900f28dfb8097a0abf577179822384e5d863858087025bd40945a19ec89893",
"md5": "4480b50dfbc6c32a74e1ada944147f76",
"sha256": "e3ed7b13894bc66de929d8cf93460a8ece06fff18d811d01693b2c6fe08ca43d"
},
"downloads": -1,
"filename": "kube_agent-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "4480b50dfbc6c32a74e1ada944147f76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.11",
"size": 18160,
"upload_time": "2024-05-07T02:08:42",
"upload_time_iso_8601": "2024-05-07T02:08:42.410249Z",
"url": "https://files.pythonhosted.org/packages/9e/90/0f28dfb8097a0abf577179822384e5d863858087025bd40945a19ec89893/kube_agent-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-07 02:08:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "feiskyer",
"github_project": "kube-agent",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "kube-agent"
}