Show HN: Magic Happens – let ChatGPT manage your Kubernetes cluster https://ift.tt/h9XnKNq

Show HN: Magic Happens – let ChatGPT manage your Kubernetes cluster I built this kubernetes operator as a proof of concept this weekend.. It only has a single required item in the spec, a freeform description field. The operator will use chatgpt to generate a spec, then immediately apply it to the cluster. It makes some attempt to correct errors if there's a problem with the syntax. It will leave additional comments, questions or instructions in the status field of the object. I built this in a weekend and it's still quite unrefined. It's in no way production ready, please don't use it for anything real, but it works better than you would think, considering how simple it is. If you're going to use it, run it on a local cluster like 'kind'. Some descriptions to try: * install a redis namespace with a redis cluster and a service in it * create an argocd application in the argocd namespace to install velero. * write a python script that lists all ec2 instances in us-east-1, and run it as a k8s job with the aws credentials already saved in the default namespace.. a somewhat longer description that also worked: given the following spec: --- kind: MagicHappens apiVersion: gptmagic.io/v1 metadata: name: foo spec: description: this is a freeform description field that will be sent to chatgpt to generate kubernetes resources dryRun: false --- Can you create more magic happens resources, each of which describes an argocd application that needs to be created to install a helm chart for one of the standard cluster addons that need to be installed on a cluster for it to be production ready. The description should be be freeform text like the following: "Create an argocd application in the argocd namespace to install istio from the helm chart with all the defaults" or "Create an argocd application in the argocd namespace to install prometheus and grafana, with an ingress enabled for grafana". Be very thorough and included as many apps that might be needed for a prod ready cluster using industry standard CNCF projects if possible. (this produces a list of additional resources for the operator, which the operator then goes on to create argocd applications for -- it also left comments with instructions on one of the resources for how configure it to work with your cloud provider something to note is that since you can run arbitrary containers with arbitrary commands, and chatgpt can write arbitrary code, you don't have to limit yourself to k8s stuff.. if you've got saas credentials on the cluster, you can just tell it to run a python script as a job to do whatever you want. Since most people are cowards, there's a dryRun field that defaults to true, so it only attaches the spec to the object. It is scary how well this works. https://ift.tt/4lcQyDZ April 18, 2023 at 12:09AM

Comments