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
jesse.tang 4d95050747
fix: fmt import (#2379)
2 years ago
..
README.md test: add nacos test (#1603) 3 years ago
config.go fix: fmt import (#2379) 2 years ago
config_test.go test(contrib): add unit test for contrib/config/k8s (#2140) 3 years ago
go.mod build(deps): bump k8s.io/client-go in /contrib/config/kubernetes (#2217) 2 years ago
go.sum build(deps): bump k8s.io/client-go in /contrib/config/kubernetes (#2217) 2 years ago
watcher.go fix: fmt import (#2379) 2 years ago
watcher_test.go fix: contrib config kubernetes lint err (#1523) 3 years ago

README.md

Kubernetes Config

Usage in the Kubernates Cluster

It is required to

serviceaccount should be set to the actual account of your environment, the default account will be namespace::default if the spec.serviceAccount is unset. execute this command:

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

or use 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

Usage outside the Kubernates Cluster

Set the path ~/.kube/config to KubeConfig

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