Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement k8s service discovery #988

Merged
merged 10 commits into from
Sep 4, 2021
Merged

implement k8s service discovery #988

merged 10 commits into from
Sep 4, 2021

Conversation

kevwan
Copy link
Contributor

@kevwan kevwan commented Sep 3, 2021

Create service account through the following command.

kubectl apply -f serviceaccount.yaml

serviceaccount.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: endpoints-reader
rules:
- apiGroups: [""]
  resources: ["endpoints"]
  verbs: ["get", "watch", "list"]

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: endpoints-reader
  namespace: adhoc

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: endpoints-reader
subjects:
- kind: ServiceAccount
  name: endpoints-reader
  namespace: adhoc
roleRef:
  kind: ClusterRole
  name: endpoints-reader
  apiGroup: rbac.authorization.k8s.io

Configure the Transform (for example) RPC as below:

Transform:
    Target: k8s://adhoc/transform:3456
  • adhoc: the namespace
  • transform: the service name
  • 3456: the service port

consul, nacos can be supported by implementing their own builders.

Implementing the service discovery by other solutions, please refer to the k8s scheme implementaion.

  • the target for consul can be consul://<something represents the service>
  • the target for nacos can be nacos://<something represents the service>

Looking forward to someone's contributions.

@kevwan kevwan added this to the 1.2.0 milestone Sep 3, 2021
@kevwan kevwan added the enhancement New feature or request label Sep 3, 2021
@kevwan
Copy link
Contributor Author

kevwan commented Sep 3, 2021

Checkout discussions in #478

Thanks to @shiquan1988

@kevwan kevwan linked an issue Sep 3, 2021 that may be closed by this pull request
@kevwan kevwan merged commit 20f665e into zeromicro:master Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go zero 可以用nacos 做注册中心以及配置中心吗?
2 participants