如何在Go中使用kubernetes的inclusterconfig [英] How to use inclusterconfig of kubernetes in go
本文介绍了如何在Go中使用kubernetes的inclusterconfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码创建kubernets-client
I am creating kubernets-client using following code,
在这里,我正在尝试使用该文件路径加载配置文件.但是,我想要使用inclusterconfig创建客户端而不必加载file.show确切的代码,我应该导入什么以及所有内容与此相关
here, i am trying to load config file using that file path.but, i want to create client using inclusterconfig without having to load file.show the exact code and what should i import and everything related to this
var kube_config_path = "/home/saivamsi/.kube/config"
var config, conferr = clientcmd.BuildConfigFromFlags("", kube_config_path)
var clientset, cler = kubernetes.NewForConfig(config)
推荐答案
这是一个
这篇关于如何在Go中使用kubernetes的inclusterconfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文