0

I've read about Kubernetes custom resources and have seen controllers in go language. But I can't understand how i can connect the CR to my App deployment.

I've written a NodeJS/Express REST API, the problem is how I can make it a part of Kubernetes api endpoints?

Lady Sonia
  • 41
  • 4
  • What are you trying to do with it? Say I write a YAML file that uses the custom resource type and `kubectl apply` it; how does that interact with the REST service you've written? – David Maze Jun 15 '23 at 13:29
  • @DavidMaze, yes and how i can connect it to my REST service, e.g ```kubectl get ladies``` then it connect to my REST end point and respond my JSON. – Lady Sonia Jun 15 '23 at 13:34
  • or ```kubectl create ladywatcher -n lady1``` then create a custom prometheus exporter for ```lady1``` namespace. something like that. – Lady Sonia Jun 15 '23 at 13:36
  • `kubectl get ...` will always return an object from the Kubernetes API server. It sounds like you might need to write a [controller](https://kubernetes.io/docs/concepts/architecture/controller/) that reads the custom resource, makes the HTTP call, and writes the response into some Kubernetes object (could be the same one or a new managed object). – David Maze Jun 15 '23 at 13:36
  • Yes and I can't find out a sample controller structure in JS, there's only for GoLang or JAVA. – Lady Sonia Jun 15 '23 at 13:38
  • @DavidMaze it seems this is what I need. https://www.npmjs.com/package/@dot-i/k8s-operator – Lady Sonia Jun 16 '23 at 10:11

0 Answers0