You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/contrib/config/kubernetes
Tony Chen b92e8a9da8
deps: update otel to v1.0.0-rc3 (#1466)
3 years ago
..
README.md refactor: move plugins to contrib dir (#1399) 3 years ago
config.go refactor: move plugins to contrib dir (#1399) 3 years ago
config_test.go refactor: move plugins to contrib dir (#1399) 3 years ago
example.go refactor: move plugins to contrib dir (#1399) 3 years ago
go.mod refactor: move plugins to contrib dir (#1399) 3 years ago
go.sum deps: update otel to v1.0.0-rc3 (#1466) 3 years ago
watcher.go refactor: move plugins to contrib dir (#1399) 3 years ago
watcher_test.go refactor: move plugins to contrib dir (#1399) 3 years ago

README.md

kube

Kubernetes is a service discovery.

kube集群内部署

集群内部署需要权限 kubectl执行

serviceaccount 请调整为实际环境account。在未指定spec.serviceAccount情况下默认为namespace::default

kubectl create clusterrolebinding go-kratos:kube --clusterrole=view --serviceaccount=mesh:default

或者 kubect apply -f bind-role.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: go-kratos:kube
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
- kind: ServiceAccount
  name: default
  namespace: mesh

集群外运行

指定 .kube 文件访问

    config.NewSource(SourceOption{
		Namespace:     "mesh",
		LabelSelector: "",
		KubeConfig:    filepath.Join(homedir.HomeDir(), ".kube", "config"),
	})