Hi,
We vendor libnetwork's ipvs library into kubernetes and we are trying to do ipvs connection graceful termination by two steps:
This is for graceful terminate long lived connection, and we think this is an reasonable requirement.
So I'm wondering do we have any plan to support get IPVS connection status?
Thanks.
@mavenugo @fcrisciani Please take a look. Thanks.
@Lion-Wei we are actually doing it today in libnetwork but not with the connection tracking.
Once a service is disabled we are down weighting it to 0 so that new connection are not going to be LB on that, and we are removing the ipvs rule once the container exit. The time between the weight to 0 and the removal of the ipvs rule is managed by the graceful shutdown period.
Also we are setting the flag: net.ipv4.vs.expire_nodest_conn
(https://github.com/docker/libnetwork/commit/007f5cf3e28e99f3a33c1580f3f1589910279fd2)
That will ensure that once the rule is removed the connection associated to that rule will be purged from the ipvs connection tracking table.
Let me know if you want to discuss in person and see what can we do on the K8s side.
@fcrisciani Thanks for replaying. I think we can accept use graceful shutdown period, but I still think connection tracking would be a better way.
Is this what we can do, to add a interface of connection status? I'm not very familiar with netlinksocker, but if this is what we needed, I think I can do some work.
Thanks.
@Lion-Wei I think I added already in the netlink library the api to dump the conntrack table: https://github.com/vishvananda/netlink/blob/master/conntrack_linux.go#L50
You can use that method to dump the content. Are you planning to dump poll on it while there is no more connections around?
@fcrisciani Hi, thanks for your information.
I found we can add ActiveConnections/InactiveConnections to Destination, and get those information from sttr. And sended a pr about it. Not sure if this is appropriate.
Anyway, PTAL, thanks.
code got merged closing