1. 程式人生 > >k8s client-go使用舉例

k8s client-go使用舉例

容器中執行命令:

https://github.com/appscode/searchlight/blob/22632646424bdd34c98bdaec87553fd182a85945/plugins/check_pod_exec/lib.go#L62

建立client和controller:https://zhuanlan.zhihu.com/p/34192361

code-generagtor:

     (1)生成全部功能API server, controler,client:

http://www.infoq.com/cn/articles/kubernetes-status-management-and-extension

    (2)生成client端程式碼:

       初步使用方法:http://www.mamicode.com/info-detail-2313039.html

http://blog.xbblfz.site/2018/09/19/k8s%E4%BB%A3%E7%A0%81%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E8%BF%87%E7%A8%8B%E7%9A%84%E8%A7%A3%E6%9E%90/

https://kknews.cc/other/6586rql.html

(3)k8s三種client使用:

https://blog.csdn.net/yevvzi/article/details/52768288

clientset:https://blog.csdn.net/yevvzi/article/details/52768288(k8s核心已經有的資源,使用方便,固定)

dynamicclient:https://blog.csdn.net/yevvzi/article/details/54380944(比clientset靈活,加入thirdparty的各種操作介面,比clientset稍微麻煩,需要自定義引數較多)

restclient:https://blog.csdn.net/yevvzi/article/details/54426775

(各種client的底層)

 

經驗分享:https://kknews.cc/other/6586rql.html