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

Add rpc service port for tezos node #526

Merged
merged 1 commit into from Dec 21, 2022
Merged

Add rpc service port for tezos node #526

merged 1 commit into from Dec 21, 2022

Conversation

puppetninja
Copy link
Collaborator

@puppetninja puppetninja commented Dec 20, 2022

Currently rpc port is export from a NodePort service with a selector, this is not that
flexible in some use scenarios.

This commit exports the rpc port for tezos node service with ClusterIP, this allows more flexible service route for k8s ingress, e.g. backend rpc services can be directed based on uri path to different tezos node services.

Currently rpc port is export from a NodePort service with a selector, this is not that
flexible in some use scenarios. This commit exports the rpc port for tezos node service
with ClusterIP, this allows more flexible service route for k8s ingress, e.g. backend rpc
services can be directed based on uri path to different tezos node services.
@harryttd
Copy link
Collaborator

Thanks for this PR.

I don't see any problem with implementing your change, but just for my understanding, can you elaborate on what you were trying to do that this solves?

FYI this is not a ClusterIP service. It is a headless service as the ClusterIP field is set to None. Headless service gives each pod their own dns record that we can target individually. As long as the container port is exposed, which it is in _containers.tpl, it can be targeted. Honestly I'm not even sure we really need to specify any port at all on a headless service, but see https://stackoverflow.com/questions/51196903/do-we-really-need-port-for-a-headless-service.

@puppetninja
Copy link
Collaborator Author

@harryttd My use scenario is that I am using one ingress to route different rpc traiffic with different URI path to different types of nodes, like rolling nodes and archive nodes. so targeting each pod is what I need, but as the rpc port is not forwarded so I am adding one here.

@orcutt989
Copy link
Contributor

orcutt989 commented Dec 20, 2022

Thanks so much for the PR!!! 😄
Looking at how this works I am confused. We already break out the RPC as its own service, why would one also need this? This may be a dumb question but couldn't you just forward the traffic off port 32006 (NodePort) to whatever URIs you need?

@puppetninja
Copy link
Collaborator Author

puppetninja commented Dec 21, 2022

Hi @harryttd @orcutt989 I will elaborate more about my scenario, so I deployed two types of nodes rolling and archive, which deployed two services here, and one nodeport service

Screenshot from 2022-12-21 17-51-59

And I use nginx ingress controller to route different traffic to these two services based on path
Screenshot from 2022-12-21 17-57-26

As for nginx ingress controller, pod IP is being used by upstream service

https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#service-upstream
By default the NGINX ingress controller uses a list of all endpoints (Pod IP/port) in the NGINX upstream configuration.

@orcutt989
Copy link
Contributor

Sounds good we discussed it with @nicolasochem and he explained also. @harryttd should be around with his thoughts and an approval soon. Thanks again for contributing! 🙏

@puppetninja puppetninja merged commit 595c327 into master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants