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

Be able to bind statefulsets to the host network #51

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

angel9484
Copy link

when the client is outside of kubernetes cluster and you cannot put a proxy between client and redis-cluster-operator we needed to change code to bind the stateful to host dedicated nodes.
This change make it configurable

Copy link
Contributor

@polefishu polefishu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angel9484 Thanks for your interest on the redis-cluster-operator!
The redis exporter container also need to set the port HostPort.

@sravyav
Copy link

sravyav commented Aug 10, 2020

is it possible choose different port for redis deployment. we are planning to use multiple redis clusters and setting host network true requires lot of nodes. So, we are planning to choose different port for each redis cluster.

@angel9484
Copy link
Author

is it possible choose different port for redis deployment. we are planning to use multiple redis clusters and setting host network true requires lot of nodes. So, we are planning to choose different port for each redis cluster.

that's a great idea!, I had no time to finish this PR but my company liked your suggestion so I will try to work on this asap 👍

@angel9484
Copy link
Author

@angel9484 Thanks for your interest on the redis-cluster-operator!
The redis exporter container also need to set the port HostPort.

gotcha! I hope to work on this soon :)

@angel9484
Copy link
Author

@angel9484 Thanks for your interest on the redis-cluster-operator!
The redis exporter container also need to set the port HostPort.

@polefishu why to expose the exporter with a host port? in this case if you have a collector that get metrics and push it to (per example) prometheus, I can do it but i think for the case of the exporter is not needed, what do you think?

Thanks!!

@angel9484
Copy link
Author

angel9484 commented Aug 14, 2020

is it possible choose different port for redis deployment. we are planning to use multiple redis clusters and setting host network true requires lot of nodes. So, we are planning to choose different port for each redis cluster.

@sravyav I've updated this PR to include the posibility to configure a port in the CR.
This has a limitation. A cluster only can have the same port maped to the hostport so if you need 6 nodes of redis, you will need a set of 6 dedicated nodes in kubernetes, but you can have a very huge 6 kubernetes workers that can allocate a lot of redis clusters (each cluster with a different port).
This limitation is due I have not all the architecture knowledge of this project and maybe needs harder architectural changes. But is a tiny good step :)

@polefishu
Copy link
Contributor

is it possible choose different port for redis deployment. we are planning to use multiple redis clusters and setting host network true requires lot of nodes. So, we are planning to choose different port for each redis cluster.

@sravyav I've updated this PR to include the posibility to configure a port in the CR.
This has a limitation. A cluster only can have the same port maped to the hostport so if you need 6 nodes of redis, you will need a set of 6 dedicated nodes in kubernetes, but you can have a very huge 6 kubernetes workers that can allocate a lot of redis clusters (each cluster with a different port).
This limitation is due I have not all the architecture knowledge of this project and maybe needs harder architectural changes. But is a tiny good step :)

@angel9484 Thanks for the contribution. If we create a cluster with 3 masters and 3 slaves, this limitation requires us to distribute each redis to a different kubernetes nodes, this means we need at least 6 kubernetes nodes with free resources.
We need to set node affinity to ensure that all redis cannot be assigned to the same node.

@polefishu
Copy link
Contributor

@angel9484 Thanks for your interest on the redis-cluster-operator!
The redis exporter container also need to set the port HostPort.

@polefishu why to expose the exporter with a host port? in this case if you have a collector that get metrics and push it to (per example) prometheus, I can do it but i think for the case of the exporter is not needed, what do you think?

Thanks!!

Exporter and redis share the same network namespace.

@salla2
Copy link

salla2 commented Oct 2, 2020

@angel9484 is there any way we can connect to redis cluster exposing externally? we tried creating type LoadBalancer on service and trying to reach redis cluster from outside k8s cluster. Problem is it's connecting to lb and while adding the key its redirecting pod IP and saying it cant reachable because of this we can't achieve redis accessing externally. Any thoughts on how to fix it pls?
redis-cli -c -h nlb-endpoint.amazonaws.com -p 6379 a25cb6a74c9554926a019b274debedd0-fbe152a25a4b2c5a.elb.us-east-1.amazonaws.com:6379> set saty true -> Redirected to slot [7889] located at 10.42.24.254:6379 Could not connect to Redis at 10.42.24.254:6379: Network is unreachable Could not connect to Redis at 10.42.24.254:6379: Network is unreachable (15.42s)

@angel9484
Copy link
Author

@angel9484 Thanks for your interest on the redis-cluster-operator!
The redis exporter container also need to set the port HostPort.

@polefishu why to expose the exporter with a host port? in this case if you have a collector that get metrics and push it to (per example) prometheus, I can do it but i think for the case of the exporter is not needed, what do you think?
Thanks!!

Exporter and redis share the same network namespace.

Hi @polefishu !
Sorry for the big delay... :)
I've updated the PR with your recommendations and also changed some scripts that used the "default port ("no -p option per example) to work with the one configured.

Thanks!

angel9484 and others added 3 commits February 21, 2021 18:16
…nd_gossip_in_redis

configure more port options and monitor port in hostnetwork with hostport
…urable_port_and_gossip_in_redis

# Conflicts:
#	pkg/apis/redis/v1alpha1/distributedrediscluster_types.go
#	pkg/resources/services/service.go
…nd_gossip_in_redis

Feature/make configurable port and gossip in redis
Copy link
Author

@angel9484 angel9484 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished merging

@angel9484
Copy link
Author

@angel9484 is there any way we can connect to redis cluster exposing externally? we tried creating type LoadBalancer on service and trying to reach redis cluster from outside k8s cluster. Problem is it's connecting to lb and while adding the key its redirecting pod IP and saying it cant reachable because of this we can't achieve redis accessing externally. Any thoughts on how to fix it pls?
redis-cli -c -h nlb-endpoint.amazonaws.com -p 6379 a25cb6a74c9554926a019b274debedd0-fbe152a25a4b2c5a.elb.us-east-1.amazonaws.com:6379> set saty true -> Redirected to slot [7889] located at 10.42.24.254:6379 Could not connect to Redis at 10.42.24.254:6379: Network is unreachable Could not connect to Redis at 10.42.24.254:6379: Network is unreachable (15.42s)

Hi @salla2
redis works with node discovery. this means that if you put a LB or a dns above the redis you will only use this LB or DNS for the first time, then redis will return to the client all the ip's (advertised) and ports. This is the motivation of this PR. to let a LB beign configured with hostports and use the host network. So with this feature you will be able to configure a LB and access externaly without the usage of a proxy (with the lot of drawbacks the proxies has) with the only drawback that you are "reserving" fixed ports on the kubernetes cluster

…nd_gossip_in_redis

Feature/make configurable port and gossip in redis
fabrinator
fabrinator previously approved these changes Mar 23, 2021
@smallersoup
Copy link

Hi,Why hasn't this PR been merged for so long?

@fyankee
Copy link

fyankee commented Mar 24, 2023

Why hasn't this PR been merged? @polefishu @angel9484 @fabrinator

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.

8 participants