使用Go和Operator SDK通过API调用设置Kubernetes Pods

huangapple go评论85阅读模式
英文:

Setup Kubernetes Pods via API Call using Go and Operator SDK

问题

我正在尝试使用operator-sdkGo创建一个可以通过API调用创建和删除Pod的控制器。该控制器应该能够接受一个包含信息的POST调用,例如{imageTag:"", namespace:""},以设置一个可以返回podId的Pod,并且还应该能够使用podId通过API调用删除Pod。

我已经查阅了一些教程,但我不清楚Go操作符如何拦截API调用。这种操作是否可能?对于这个问题的任何帮助将不胜感激。谢谢。

英文:

I am trying to create a controller that can create and delete Pods via API calls using operator-sdk with Go. The controller should be able to accept a POST call with information such as {imageTag:"", namespace:""} to setup a Pod that can return a podId, and also be able to delete a Pod via API call using podId.

I have reviewed some tutorials, but I am unclear on how the Go operator can intercept API calls. Is this possible? Any help on this matter would be greatly appreciated. Thanks.

答案1

得分: 1

我发现Kubernetes Client和Kubernetes Operator是两个不同的概念。
最终我创建了一个使用Kubernetes Go Client的库,通过它我能够实现我的目标。

你可以在这里参考这个库。
https://github.com/kubernetes/client-go

英文:

Found that Kubernetes Client and Kubernetes Operator are two different concepts.
Ended up creating a Kubernetes Go Client using which I was able achieve my goal.

You can refer the library here.
https://github.com/kubernetes/client-go

huangapple
  • 本文由 发表于 2023年6月17日 08:50:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76494278.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定