kubernetes - 有没有什么值可以通过k8s-client-go来识别唯一的k8s集群?
问题描述
我使用 client-go 来管理多个 k8s 集群。有没有什么独特的标记可以用来区分不同的k8s集群?
解决方案
This is an open issue, yet to be supported. But the current workaround is the use of the kube-system namespace UID. Two or more clusters can have the same kube-system UID(by taking backup of etcd), but this is a very rare case.
kubeSystem, err := client.CoreV1().Namespaces().Get(context.TODO(),"kube-system",metav1.GetOptions{})
if err != nil {
log.Fatal(err)
}
uniqueID := kubeSystem.UID
推荐阅读
- arrays - 将元素附加到bash中的数组
- typescript - 如果字符串与数组中的字符串相同,如何在 Typescript 中设置过滤器以过滤掉字符串?
- reactjs - 异步调用后状态变为未定义
- django - django booleanfield 是 None 而不是 False
- reactjs - 如何修复'找不到模块'babel-types'
- java - 如何将 RFC 3339 日期字符串解析为 ZondeDateTime?
- javascript - 可选择在对象中添加一个键
- html - FA 图标和文本换行的 HTML/CSS 问题
- arrays - 为 DNA 序列创建数组哈希,Perl
- oracle - AWS Athena 中的“整数溢出”超过 8 亿条记录