Seems like the kind of thing that a Deployment should be able to manage on its own... some kind of DrainPolicy object maybe? Also, if the previous ReplicaSet a Deployment is rolling past has several pods, maybe only some of them need to stay alive (maybe some drain sooner than others.) Perhaps the whole endeavor should just be to make Pod drainage a bit more explicit than just terminationGracePeriodSeconds... perhaps…
Rainbow Deployments with Kubernetes
21–30 of 41 posts
Re: Rainbow Deployments with Kubernetes
#22> We still have one unsolved issue with this deployment strategy: how to clean up the old deployments when they’re no longer serving (much) traffic. Could probably solve this with a readiness probe / health check of sorts that is smart enough to know what low usage means.
Re: Rainbow Deployments with Kubernetes
#23I'm curious though, if the rollout was over a couple of hours for example, why would reconnections be that big of a problem? We host about 10,000+ websocket on a $20 VPS, and the Go server hosting it crashes from time to time. A surge of 10,000 reconnections instantly afterwards has never lasted for more than a minute or so, so why is it so bad? Moments of peak load aren't that big of a deal, or?
Re: Rainbow Deployments with Kubernetes
#24Question for the OP- I haven't ever worked on chat services, so this may not be reasonable. Would it be possible to use some other termination endpoint that sits in front of the service, that allows you to maintain persistent connections to the clients, but make for more transparent swaps of backend services? So, for example could you leverage nginx or haproxy as the "termination" point for the chat connection, with…
This is essentially how Pushpin ( http://pushpin.org ) works. It can hold a raw WebSocket connection open with a client, but it speaks HTTP to the backend server, and the backend can be restarted without the client noticing.
I have used it before. Super easy to setup. Even with kubernetes.
Re: Rainbow Deployments with Kubernetes
#25This was really interesting. I'm thinking about moving to Kubernetes and have wondered how to gracefully deal with websocket connections. I'm curious though, if the rollout was over a couple of hours for example, why would reconnections be that big of a problem? We host about 10,000+ websocket on a $20 VPS, and the Go server hosting it crashes from time to time. A surge of 10,000 reconnections instantly afterwards ha…
Re: Rainbow Deployments with Kubernetes
#26I'm not sure what problem the author is solving. I might be misunderstanding something. The author points out that the issue with Blue/Green/AnyColors deploys is that they need 16 pods per color at all time (which in their case would end up being 128 pods) and 24/48 hours for each connection pool to drain. But how is using a SHA instead of a COLOR any different? Unless I am missing something, and, if running 128 pods…
Re: Rainbow Deployments with Kubernetes
#27This was really interesting. I'm thinking about moving to Kubernetes and have wondered how to gracefully deal with websocket connections. I'm curious though, if the rollout was over a couple of hours for example, why would reconnections be that big of a problem? We host about 10,000+ websocket on a $20 VPS, and the Go server hosting it crashes from time to time. A surge of 10,000 reconnections instantly afterwards ha…
Re: Rainbow Deployments with Kubernetes
#28Earlier quoted context omitted.
This is essentially how Pushpin ( http://pushpin.org ) works. It can hold a raw WebSocket connection open with a client, but it speaks HTTP to the backend server, and the backend can be restarted without the client noticing.
This is a nginx module for this functionality https://nchan.io/ I have used it before. Super easy to setup. Even with kubernetes.
Re: Rainbow Deployments with Kubernetes
#29Seems like the kind of thing that a Deployment should be able to manage on its own... some kind of DrainPolicy object maybe? Also, if the previous ReplicaSet a Deployment is rolling past has several pods, maybe only some of them need to stay alive (maybe some drain sooner than others.) Perhaps the whole endeavor should just be to make Pod drainage a bit more explicit than just terminationGracePeriodSeconds... perhaps…
yeah I don't know why terminationGracePeriodSeconds hacks didn't work. It could have been a different, unrelated factor that we didn't discover. It certainly could have been service-loadbalancer/haproxy's fault instead of the termination grace period itself. I'm certainly happy to be proven wrong there.
So if you set a 5 hour grace period, and a preStop hook that invokes a script that doesn’t return until all connections are closed (but which tells the container process not to accept new ones) you can control the drain rate.
There is some app level smarts required - to have new connections rejected and have any proxies rebalance you. Haproxy does this in most cases, but the service proxy won’t (in iptables mode).
If that’s not the behavior you’re seeing, please open a bug on Kube and assign me (this is something I maintain)