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

telepresence should cleanup/kill its own inactive an expired pods #920

Closed
sokoow opened this issue Feb 6, 2019 · 8 comments
Closed

telepresence should cleanup/kill its own inactive an expired pods #920

sokoow opened this issue Feb 6, 2019 · 8 comments

Comments

@sokoow
Copy link

sokoow commented Feb 6, 2019

Hi All,

Telepresence currently has problems cleaning up pods and deployments after itself. Here's a snapshot after couple of days of work:

pods:

telepresence-1547700365-423302-47147-6875bc4cc8-bgz5g   1/1     Running     0          16d
telepresence-1547702626-319927-47984-6fb967cb5-nx4nb    1/1     Running     0          16d
telepresence-1547706680-838876-49122-77b868bf7d-bcqg9   1/1     Running     0          16d
telepresence-1547712456-517427-54707-b5776bfdb-vj4bl    1/1     Running     0          16d
telepresence-1547712471-276171-54786-58f679576-5kw8k    1/1     Running     0          16d
telepresence-1547713700-630524-55675-775d5b8bf8-tqgx7   1/1     Running     0          16d
telepresence-55dffdcfc9-7967h                           1/1     Running     0          30d

deployments:

telepresence                           1/1     1            1           30d
telepresence-1547700365-423302-47147   1/1     1            1           20d
telepresence-1547702626-319927-47984   1/1     1            1           20d
telepresence-1547706680-838876-49122   1/1     1            1           20d
telepresence-1547712456-517427-54707   1/1     1            1           20d
telepresence-1547712471-276171-54786   1/1     1            1           20d
telepresence-1547713700-630524-55675   1/1     1            1           20d

Not ideal.

@ark3
Copy link
Contributor

ark3 commented Feb 6, 2019

Agreed! Sorry about that. See also #260 (comment).

@sokoow
Copy link
Author

sokoow commented Feb 6, 2019

Hey no worries, it's a great idea and great project, just some corners to smooth out

@ark3
Copy link
Contributor

ark3 commented Feb 7, 2019

Out of curiosity, did those deployments get created using the (default) new deployment operation? Were any services left behind? I have an idea that I'd like to explore...

@sokoow
Copy link
Author

sokoow commented Feb 25, 2019

I think devs just left these behind, closed their laptops and telepresence lost their connection to the cluster. Afterwards, when they opened their laptops again, connections expired, leaving the proxy hanging.

@maelvls
Copy link

maelvls commented Nov 17, 2019

We also have the issue of 'interrupted' telepresence connections leaving many dangling deployments & pods.

Just wondering, is there an easy way (with kubectl) to cleanup all telepresence deployments that have been created more than 1d ago? Since a telepresence session is often short, any deployments older than 1 day are probably leftovers 😁

For now, I use

kubectl delete deployments -l telepresence

but it might as well kill 'in-use' deployments

@PPACI
Copy link

PPACI commented Jan 8, 2021

kubectl get pods -A -l telepresence -o json | jq -r '.items[] |select((.metadata.creationTimestamp | now - fromdateiso8601) > 86400) | @sh "kubectl delete --grace-period=1 -n \(.metadata.namespace) pod/\(.metadata.name)"' | xargs
For people coming here from Google searching for a way to clean expired pods, this will delete all telepresence older than 1 day. Note that this require JQ to be installed. I'm sure there is a way to do it with only kubectl, but I was a bit lazy 🙃.

@donnyyung
Copy link
Contributor

I believe this is no longer an issue in Telepresence 2 since you can use the telepresence uninstall command to uninstall agents + the traffic-manager. Here are the docs on how to install Telepresence (https://www.telepresence.io/docs/latest/install/), please re-open if you still see this issue in our latest version!

@QuinnBast
Copy link

The uninstall command posted above just tries to install the traffic-manager again.

$ telepresence uninstall --everything
Launching Telepresence Root Daemon
Launching Telepresence User Daemon
...

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

No branches or pull requests

6 participants