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

Sticky IPs for StatefulSet #28969

Closed
bprashanth opened this issue Jul 14, 2016 · 77 comments
Closed

Sticky IPs for StatefulSet #28969

bprashanth opened this issue Jul 14, 2016 · 77 comments
Labels
area/stateful-apps kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/network Categorizes an issue or PR as relevant to SIG Network.
Projects

Comments

@bprashanth
Copy link
Contributor

Most of the databases I (https://github.com/kubernetes/kubernetes/tree/master/test/e2e/testing-manifests/petset) and others (#28718 (comment)) have prototyped seem to handle DNS properly, but there are murmurs that some do not (#23828 (comment)), and dont' have plans to do so (#28718 (comment)).

I'd still vote for defering any implementation till we have the end to end models fleshed out. One might imagine that databases understand the importance of DNS ttl.

@chrislovecnm
Copy link
Contributor

I am checking to see if Cassandra can run on DNS fully. It works for lookup of seeds, but I am seeing that IP Addresses gets bound to a token range.

@chrislovecnm
Copy link
Contributor

I have confirmed that Cassandra does need this. The Datastax team has toyed with the idea of using DNS, but at this time it is not support to use pure DNS with Cassandra.

@bprashanth
Copy link
Contributor Author

Great! do you have a bug / doc for context

@chrislovecnm
Copy link
Contributor

@bprashanth nope email from Datastax folks. They asked me to file a Jira if I wanted to recommend a change.

@zefciu
Copy link
Contributor

zefciu commented Jul 18, 2016

I have an idea to implement this feature in calico-containers. I believe that a thing like sticky IPs is not something k8s is responsible for. I still however need a confirmation that this is a requirement for galera to get a blessing for this feature.

@chrislovecnm
Copy link
Contributor

@zefciu with calico would this be able to work with internal IPs / DNS that PetSet uses? We need a pet to have a sticky IP address. Also I understand using calico, but this may want to be self contained in k8s.

@chrislovecnm
Copy link
Contributor

chrislovecnm commented Jul 19, 2016

To add more color sticky IP address that is in the internal private subnet the cluster and minions use. This is not a sticky public ip.

@zefciu
Copy link
Contributor

zefciu commented Jul 19, 2016

The solution is to use annotations, that sent by CNI would make calico either use dynamic or static IPs. I don't know how can we solve the static IP logic in k8s itself if its outsourcing all the job of setting up network interfaces to plugins.

@bprashanth
Copy link
Contributor Author

The way I would like to solve it is by defining a staitc-ip-subnet (just like podCIDR assigned to nodes), from which we'd draw these limited ips and assign them to pods. If a pod with the limited edition ip dies, we reprogram the routes so traffic flows to whichever node it lands, just like we setup routes today to route podCIDR to specific nodes.

The easier way to solve static ip is through a Service vip, but I don't like that for a couple of reasons (occupies iptables space, requires Svc per pod, wont work cross kube-cluster).

@zefciu
Copy link
Contributor

zefciu commented Jul 20, 2016

@bprashanth: and how would your solution work with plugins? Would it simply sent this desired IP to the plugin, or will it take some of the plugin's responsibilities?

@bprashanth
Copy link
Contributor Author

network plugins are responsible for allocating ips from a given range today, not between nodes. This range is the pod cidr. Something assigns podCIDRs and setups up routing (whatever that may be, it isn't a plugin yet. It could be CP specific route controller or something like flannel). The plugin will only be responsible for eg: creating a veth with the allocated ip and shoving in the netns. IPAM itself is a plugin within the CNI plugin.

@magicwang-cn
Copy link
Contributor

magicwang-cn commented Aug 2, 2016

init-containers also shares the same network with the whole pod, so why not get the sticky ips in the init-containers?

@slaskawi
Copy link
Contributor

As for JBoss projects based on JGroups (like Infinispan for example), we probably need to write a new discovery protocol based on DNS (I proposed it on Infinispan dev mailing list and waiting for a response). Currently some of us use KUBE_PING (which queries Kubernetes API and collects containers) but trusting DNS would probably be a much better option.

However we (the Infinispan Team) would be very interested in exposing PetSets to the outside world. Our Hot Rod client can take the advantage of topology information and optimize queries. Having a public Sticky IPs (or anything that let's client decide to which Pod the request should be forwarded) would be very important for us.

@chrislovecnm
Copy link
Contributor

@thockin this is the one I meant to comment on. Who is setting the priority of this one? Would a proposal be a good start?

@thockin
Copy link
Member

thockin commented Oct 10, 2016

A proposal is always a good start

@krmayankk
Copy link

@chrislovecnm are you writing this proposal ?

@chrislovecnm
Copy link
Contributor

@krmayankk not had any time ... And frankly found a work around ish for Cassandra

@k8s-github-robot
Copy link

@bprashanth There are no sig labels on this issue. Please add a sig label by:
(1) mentioning a sig: @kubernetes/sig-<team-name>-misc
(2) specifying the label manually: /sig <label>

Note: method (1) will trigger a notification to the team. You can find the team list here.

@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label May 31, 2017
@caseydavenport
Copy link
Member

/sig network

@k8s-ci-robot k8s-ci-robot added the sig/network Categorizes an issue or PR as relevant to SIG Network. label Jun 1, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 1, 2017
@0xmichalis 0xmichalis added sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed team/cluster (deprecated - do not use) labels Jun 3, 2017
@braedon
Copy link

braedon commented Aug 20, 2017

Hi @chrislovecnm, we've having problems running Cassandra in stateful sets due to this - while we're waiting for a solution, could you share your workaround? Thanks!

@enisoc enisoc changed the title sticky ips for petset Sticky IPs for StatefulSet Sep 7, 2017
@freehan freehan added kind/feature Categorizes issue or PR as related to a new feature. and removed triage/unresolved Indicates an issue that can not or will not be resolved. labels May 16, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 14, 2019
@agolomoodysaada
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 15, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 13, 2019
@aspyct
Copy link

aspyct commented Nov 13, 2019

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 13, 2019
@vadalikrishna
Copy link

@krmayankk not had any time ... And frankly found a work around ish for Cassandra

Can you please share your work around, I am facing a similar issue with cassandra in statefulset.

@cscetbon
Copy link

@vadalikrishna @krmayankk any information on the workaround would be much appreciated

@madireddyr
Copy link

@krmayankk @vadalikrishna chrislovecnm : any info how you resolved this issue

@cscetbon
Copy link

@brouberol What if two cassandra pods are going down at the same time?

Say pod A is running on k8s node 1, and pod B is running on k8s node 2.
They both go down at the same time.
What's to prevent pod A from starting again on node 2, and therefore getting the IP address that was previously assigned to pod B?
It's definitely a problem when both nodes are getting IPs of each other. Cassandra complains that an existing node already holds the tokens the current node is trying to get and refuses to start.

That's why if someone like @chrislovecnm has a workaround it would be much appreciated to know it.

@allamand Does someone have tested the option from calico :

annotations:
"cni.projectcalico.org/ipAddrs": "["192.168.0.1"]"

as you know, the issue is we can't assign different annotations to nodes belonging to a StatefulSet

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 15, 2020
@dpepper
Copy link

dpepper commented May 8, 2020

Say pod A is running on k8s node 1, and pod B is running on k8s node 2.
They both go down at the same time.
What's to prevent pod A from starting again on node 2, and therefore getting the IP address that was previously assigned to pod B?
It's definitely a problem when both nodes are getting IPs of each other. Cassandra complains that an existing node already holds the tokens the current node is trying to get and refuses to start.

Did anyone find a solution for this?

@allamand
Copy link

allamand commented May 8, 2020

You can force podA to stay on node1 using local storage and persistent volume claim

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 7, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Workloads automation moved this from Backlog to Done Jul 7, 2020
@arianvp
Copy link

arianvp commented Aug 31, 2020

Can we reopen this? This is still very relevant for many workloads that now have issues running on kubernetes manually. Including Audio/Video (STUN/TURN etc), redis and cassandra.

@arianvp
Copy link

arianvp commented Aug 31, 2020

If you are using Calico, you could add https://docs.tigera.io/networking/use-specific-ip to each pod manually. To assign a fixed IP to each pod. However you'd have to add the annotation to new pods that get created when you scale up; which is a bit annoying.

Also it's racey; as the Pod is first created with a different IP; and then you change it after the fact; which is not ideal as some workloads will get very upset from that (e.g. cassandra) which is what we're trying to prevent with this issue in the first place. No. you cabn only set these fields during pod creation time unfortunately

It would be really cool if we could add an annotation to the StatefulSet that Calico interprets and then does this automatically. Listen to pods being created; and then add a fixed IP to the pod

@alitoufighi
Copy link

Can we have this issue reopened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/stateful-apps kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/network Categorizes an issue or PR as relevant to SIG Network.
Projects
Workloads
  
Done
Development

No branches or pull requests