-
Notifications
You must be signed in to change notification settings - Fork 107
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
App gets stuck deleting if service account is not created #114
Comments
I have also run into the issue described above in a similar scenario where I have used Could be similar to #69 but can dig a bit further to see if the issue itself has different nuance to it. |
Related to #71 |
Adding Reasonable solutions could be:
|
related: #34 |
Hey @benmoss, After some discussion, we've decided the best thing we could do here is to update the error message with a bit more info. Since kapp-controller will be deleting resources, we need a service account that has the roles needed to do the deletion, so that we know it is allowed from an rbac standpoint. This means if the service account can't be found, kapp-controller won't be able to delete things safely. Going forward, the easiest remedy in this case is to create the service account again. We will be sure to call this information out in the error message when we update it. Thanks! |
We will also explicitly document how to resolve this issue in kapp-controller docs. As part of documenting how to address this issue, something we will need to call out is what are minimum rbac permissions needed for the serviceaccount to resolve this issue so a user can proceed with deleting the App. |
If I had to guess why it's not straightforward: Since it never had the service account in the first place it didn't create anything, but the tricky bit is knowing that for certain. You might also be in a situation where the service account existed, resources were created, and then the service account was deleted, and so knowing the difference would mean caching that state of "i created x, y, z" on the app itself? |
ah, this is a good case to address. |
I will update this issue to call out fixing that specific case and create another one for improving docs or error messages for the case resources do exist. Problem statementKapp controller currently doesn't distinguish between deletes that will delete resources and deletes that just require deleting the App CR. This means, when a service account is missing, kctrl refuses to perform a delete in both cases, even though the former is the only one that requires a service account. Desired Statekapp controller is able to delete apps that have not had any resources deployed without a service account being present. Use Case
|
We saw another version of this bug when trying to delete a namespace that contains a kapp app and a service account that it refers to. The whole mess hangs forever after the service account gets deleted before the kapp finalizer can run. |
+1 to @julian-hj ... |
One solution here might be to add the In combination with #1132, this could introduce the following model:
† Note that adding this |
What is the best way to resolve this once you get into this stat? You can't recreate the service account because the namespace is |
@ryanjbaxter If you are already in this state, then you can remove the finalizers on the App CR. This might have side effect, if there were any resources created outside the namespace by the App, then those would still remain. |
So ... I got this wedged pretty good just now when a tanzu package install of cert manager failed on a vCenter 8 TKG 2.2 cluster. Not totally sure that is supposed to work -- but I couldn't edit the finalizers on the App CR because kubectl claimed it couldn't find the app (even though it was letting me edit it). I finally had to issue a "create namespace cert-manager" and THEN kubectl let me edit the app and remove the finalizers. I also had to remove some remaining cert manager service account stuff (clusterrole, maybe some other cluster-scoped stuff) by hand. n.b., you have to "replace" finalizers with an empty array -- just deleting the key will leave the original value there and it will stay stuck. I'm fairly new to k8s, but this is definitely one of the trickier situations I've had to try to get myself out of. Any additional pointers or automated things that could have been done would have helped me. EDIT: by the way, for others experiencing this problem, I'll share my root issue as a possible lead (as someone new to k8s, a hint like this would've help me a lot). Deep under the hood, (i.e., PackageInstall -> App -> ... -> ReplicaSet -> ) pods were failing to spin up in the |
What steps did you take:
Installed the "simple-app" from the instructions without first creating the service account for it.
https://github.com/vmware-tanzu/carvel-kapp-controller/blob/develop/docs/walkthrough.md
Tried to delete the app via
kapp -a simple-app delete
and see it hang/timeout.What happened:
What did you expect:
Delete should succeed
Anything else you would like to add:
Environment:
The text was updated successfully, but these errors were encountered: