-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Deploy a sweeper pod to clear completed pod histories #4500
Conversation
kube/resources/pod-sweeper.yaml
Outdated
command: | ||
- /bin/sh | ||
- -c | ||
- while :; do kubectl get pod | grep Completed | awk '{print $1}' | xargs --no-run-if-empty kubectl delete pod | xargs --no-run-if-empty echo `date "+%Y-%m-%d %H:%M:%S"`; sleep 300; done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't handle namespaced airbyte deployments. It also doesn't limit itself to just pods that were created as part of Airbyte.
Probably the easiest way to do this is to add a label to all connector pods / command fetcher pods that makes it easy to kubectl get
them by this label. Then you can also insert the namespace used in a similar way that we pulled it in as an env variable before, and use that to scope the search for pods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to address some more edge cases but I like the simple bash pod approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
We should only clear pods that are not Running
and that are older than maybe 1 day. Right now I think this will kill things that are currently running.
It would be nice to also log the name and status for deleted pod on the sweeper.
There is a grep on Completed, is it possible for them to be completed and running at the same time? |
Pods might be stuck in an |
156e7a2
to
104d2dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
What
Closes #3634
How
Deploy a separate pod sweeper using shell command