Package: kube-copilot
Kubernetes CopilotKubernetes Copilot powered by OpenAI.Features:Automate Kubernetes cluster operations using ChatGPT (GPT-4 or GPT-3.5).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.Access the web and perform Google searches without leaving the terminal.InstallRun in KubernetesOption 1: Web UI with Helm (recommended)# Option 1: OpenAIexportOPENAI_API_KEY="<replace-this>"helminstallkube-copilotkube-copilot\--repohttps://feisky.xyz/kube-copilot\--setopenai.apiModel=gpt-4\--setopenai.apiKey=$OPENAI_API_KEY# Option 2: Azure OpenAI ServiceexportOPENAI_API_KEY="<replace-this>"exportOPENAI_API_BASE="<replace-this>"helminstallkube-copilotkube-copilot\--repohttps://feisky.xyz/kube-copilot\--setopenai.apiModel=gpt-4\--setopenai.apiKey=$OPENAI_API_KEY\--setopenai.apiBase=$OPENAI_API_BASE# Forwarding requests to the servicekubectlport-forwardservice/kube-copilot8080:80echo"Visit http://127.0.0.1:8080 to use the copilot"Option 2: CLI with kubectlkubectlrun-it--rmcopilot\--env="OPENAI_API_KEY=$OPENAI_API_KEY"\--restart=Never\--image=ghcr.io/feiskyer/kube-copilot\--execute--verbose'What Pods are using max memory in the cluster'Referkubernetes.mdfor more detailed steps.Local InstallInstall the copilot with pip command below:pipinstallkube-copilotSetup:Ensurekubectlis installed on the local machine and the kubeconfig file is configured for Kubernetes cluster access.Installtrivyto assess container image security issues (for theauditcommand).Set the OpenAIAPI keyas theOPENAI_API_KEYenvironment variable to enable ChatGPT functionality.ForAzure OpenAI service, also setOPENAI_API_TYPE=azureandOPENAI_API_BASE=https://<replace-this>.openai.azure.com/.Google search is disabled by default. To enable it, setGOOGLE_API_KEYandGOOGLE_CSE_ID(obtain fromhereandhere).How to use web UIHow to use CLIRunning directly in the terminal:Usage:kube-copilot[OPTIONS]COMMAND[ARGS]...KubernetesCopilotpoweredbyOpenAI

Options:--versionShowtheversionandexit.--helpShowthismessageandexit.

Commands:analyzeanalyzeissuesforagivenresourceauditauditsecurityissuesforaPoddiagnosediagnoseproblemsforaPodexecuteexecuteoperationsbasedonpromptinstructionsgenerategenerateKubernetesmanifestsAudit Security Issues for Podkube-copilot audit POD [NAMESPACE]will audit security issues for a Pod:Usage:kube-copilotaudit[OPTIONS]POD[NAMESPACE]auditsecurityissuesforaPod

Options:--verboseEnableverboseinformationofcopilotexecutionsteps--modelMODELOpenAImodeltouseforcopilotexecution,defaultisgpt-4--helpShowthismessageandexit.Diagnose Problems for Podkube-copilot diagnose POD [NAMESPACE]will diagnose problems for a Pod:Usage:kube-copilotdiagnose[OPTIONS]POD[NAMESPACE]diagnoseproblemsforaPod

Options:--verboseEnableverboseinformationofcopilotexecutionsteps--modelMODELOpenAImodeltouseforcopilotexecution,defaultisgpt-4--helpShowthismessageandexit.Analyze Potential Issues for k8s Objectkube-copilot analyze RESOURCE NAME [NAMESPACE]will analyze potential issues for the given resource object:Usage:kube-copilotanalyze[OPTIONS]RESOURCENAME[NAMESPACE]analyzeissuesforagivenresource

Options:--verboseEnableverboseinformationofcopilotexecutionsteps--modelTEXTOpenAImodeltouseforcopilotexecution,defaultisgpt-4--helpShowthismessageandexit.Execute Operations Based on Prompt Instructionskube-copilot execute INSTRUCTIONSwill execute operations based on prompt instructions.
It could also be used to ask any questions.Usage:kube-copilotexecute[OPTIONS]INSTRUCTIONSexecuteoperationsbasedonpromptinstructions

Options:--verboseEnableverboseinformationofcopilotexecutionsteps--modelMODELOpenAImodeltouseforcopilotexecution,defaultisgpt-4--helpShowthismessageandexit.Generate Kubernetes ManifestsUse thekube-copilot generatecommand to create Kubernetes manifests based on
the provided prompt instructions. After generating the manifests, you will be
prompted to confirm whether you want to apply them.Usage:kube-copilotgenerate[OPTIONS]INSTRUCTIONSgenerateKubernetesmanifests

Options:--verboseEnableverboseinformationofcopilotexecutionsteps--modelTEXTOpenAImodeltouseforcopilotexecution,defaultisgpt-4--helpShowthismessageandexit.ContributionThe project is opensource at githubfeiskyer/kube-copilotwith Apache License.If you would like to contribute to the project, please follow these guidelines:Fork the repository and clone it to your local machine.Create a new branch for your changes.Make your changes and commit them with a descriptive commit message.Push your changes to your forked repository.Open a pull request to the main repository.