kubernetes golang客户端上的示例 [英] Samples on kubernetes golang client
问题描述
我发现这个:
我在Go中放置了一个示例Kubernetes客户端,它允许查询API版本并进行示例NGINX部署。也许这对你有帮助: https://github.com/timoreimann/kubernetes-goclient-example
请注意,它不使用复制控制器(顺便说一下,它已被副本集),但使用较新的部署API 。我也不提供YAML文件;相反,我通过编程来定义一切。读取YAML文件并将它们解组到Kubernetes结构中应该是一件相当直接的事情。
I`m trying to create replication controllers, services etc from the golang client. ("github.com/kubernetes/kubernetes/pkg/client/unversioned") However I cannot find any documentation on how to do so.
I found this:
r, err := c.ReplicationControllers(api.NamespaceDefault).Create(rep)
But I don`t know where to put the yml data etc. Anyone who found documentation or has some sample code that I could get started with ?
I put together a sample Kubernetes client in Go that allows to query the API version and make a sample NGINX deployment. Maybe it's helpful to you: https://github.com/timoreimann/kubernetes-goclient-example
Note that it doesn't use replication controllers (which, by the way, have been replaced by replica sets by now) but uses the newer Deployments API. I also don't feed in YAML files; instead, I define everything programmatically. Reading YAML files and unmarshalling them into Kubernetes structs should be a fairly straight-forward thing to do though.
这篇关于kubernetes golang客户端上的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!