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

kubernetes: Received event spamming? #449

Closed
jonaz opened this issue Jun 9, 2016 · 11 comments · Fixed by #477
Closed

kubernetes: Received event spamming? #449

jonaz opened this issue Jun 9, 2016 · 11 comments · Fixed by #477

Comments

@jonaz
Copy link
Contributor

jonaz commented Jun 9, 2016

I get this every second. I dont think traefik should listen to this event or even subscribe to it since its the internal leader election when running multiple masters.

time="2016-06-09T09:35:38Z" level=debug msg="Received event from kubernetes map[object:map[metadata:map[resourceVersion:4596497 creationTimestamp:2016-06-07T10:40:19Z annotations:map[control-plane.alpha.kubernetes.io/leader:{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:35:38Z\",\"leaderTransitions\":0}] name:kube-controller-manager namespace:kube-system selfLink:/api/v1/namespaces/kube-system/endpoints/kube-controller-manager uid:3b0f4e50-2c9c-11e6-acdb-005056885071] subsets:[] kind:Endpoints apiVersion:v1] type:MODIFIED]" 

This might be a kubernetes issue

When i tried manually watching http://localhost:8001/api/v1/endpoints?watch=true i get:

{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-scheduler","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-scheduler","uid":"3a9db9fc-2c9c-11e6-acdb-005056885071","resourceVersion":"4597683","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:21Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-controller-manager","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-controller-manager","uid":"3b0f4e50-2c9c-11e6-acdb-005056885071","resourceVersion":"4597685","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:21Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-scheduler","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-scheduler","uid":"3a9db9fc-2c9c-11e6-acdb-005056885071","resourceVersion":"4597687","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:23Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-controller-manager","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-controller-manager","uid":"3b0f4e50-2c9c-11e6-acdb-005056885071","resourceVersion":"4597688","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:23Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-scheduler","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-scheduler","uid":"3a9db9fc-2c9c-11e6-acdb-005056885071","resourceVersion":"4597689","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:25Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-controller-manager","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-controller-manager","uid":"3b0f4e50-2c9c-11e6-acdb-005056885071","resourceVersion":"4597690","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:25Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-scheduler","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-scheduler","uid":"3a9db9fc-2c9c-11e6-acdb-005056885071","resourceVersion":"4597692","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:27Z\",\"leaderTransitions\":0}"}},"subsets":[]}}
{"type":"MODIFIED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"kube-controller-manager","namespace":"kube-system","selfLink":"/api/v1/namespaces/kube-system/endpoints/kube-controller-manager","uid":"3b0f4e50-2c9c-11e6-acdb-005056885071","resourceVersion":"4597693","creationTimestamp":"2016-06-07T10:40:19Z","annotations":{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"utv-kube01\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2016-06-07T10:40:19Z\",\"renewTime\":\"2016-06-09T09:46:27Z\",\"leaderTransitions\":0}"}},"subsets":[]}}

The only thing changed is renewTime.
So i guess traefik could filter out those messages.

I found a issue upstream: kubernetes/kubernetes#23812

@emilevauge
Copy link
Member

@errm: did you get something similar on your platform ?

@olavmrk
Copy link

olavmrk commented Jun 16, 2016

I got the same problem here.

It appears that the kubernetes provider sends a new configuration for every event, even though the event doesn't actually change the configuration. Since these events arrive very frequently (several times each second), the result is that a new configuration is never applied, since it wants a two second pause in the configuration updates:

time="2016-06-16T08:54:31Z" level=debug msg="Last kubernetes config received less than 2s, waiting..." 

@mikespokefire
Copy link

Also encountering this issue myself. Maybe instead of waiting for a 2 second pause from kubernetes, is traefik aware of the last time it updated its own config and we can use that instead?

@jonaz
Copy link
Contributor Author

jonaz commented Jun 16, 2016

Or just ignore events with annotation control-plane.alpha.kubernetes.io/leader

@errm
Copy link
Contributor

errm commented Jun 16, 2016

@jonaz @mikespokefire which version of kubernetes are you currently running?

@errm
Copy link
Contributor

errm commented Jun 16, 2016

I am not seeing these, I think they are related to the --leader-elect flag on kube-scheduler or kube-controller-manager/ it seems that using endpoints like this for leader-election also causes issues for kube-proxy so it might be fixed upstream.

Currently we don't check what is in a watched event, rather just using it as a trigger to rebuild the whole config. I guess the best thing would be to filter these events to just look for changes to an IP or port...

@jonaz
Copy link
Contributor Author

jonaz commented Jun 16, 2016

@errm We're running latest stable which is v1.2.4

And yes we have --leader-elect=true following best practice guide from coreos: https://coreos.com/kubernetes/docs/latest/deploy-master.html

@mikespokefire
Copy link

We are using v1.2.3. Looking further into the problem, it seems to be the
controller manager with --leader-elect for us too.
On 16 Jun 2016 5:49 p.m., "jonaz" [email protected] wrote:

@errm https://github.com/errm We're running latest stable which is
v1.2.4


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#449 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAT9ITdzQnXcFgIxhJKqjSzVm72J2wRJks5qMX5xgaJpZM4IxytR
.

@nlf
Copy link

nlf commented Jun 17, 2016

I get this spam with leader election enabled also

@errm
Copy link
Contributor

errm commented Jun 20, 2016

Unless you are running a HA master on multiple nodes you should be able to safely remove --leader-elect so that may be a work around for some.

I have a few ideas for fixing this...

  1. Cache templateObjects in the kubernetes provider so we could test if the config has changed before it is submitted to traefik.

  2. Deserialise events as we receive them, and try to do something smart to work out if we need to do an update.

@emilevauge
Copy link
Member

See my comment #448 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants