-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Deploying your own VPA with leader election enabled in GKE conflicts with the GKE system component #7461
Comments
Some thoughts on mitigating this:
|
I see two paths forward to fixing this:
I can't speak for what that lease is being used for in GKE, but I can only assume that changing that lease is difficult or impossible in GKE. Given that the lease(s) in VPA are only used for VPA components, and running multiple recommenders and updaters for a brief period isn't that worst thing in the world, my vote is that we change the default lease name in the VPA. Any VPA configured with the lease enabled will only be running multiple pods for a short period of time, which should be fine. It's obviously not an amazing path forward, but may be worth doing. I'm curios what @voelzmo and @kwiesmueller think, as they may be the ones approving that controversial PR. |
If we do go this path, i suggest we also make PRs into 3rd party Helm charts to ensure they support the new default name. Some of them hardcode the lease name:
|
I'm not sure if changing the default in OSS is the right approach because GKE claims it too. cc. @raywainman |
My concern is that if someone follows the happy path of deployment, and enables the leases without reading documentation, then GKE breaks in ways that are not obvious. It took us 4 days and countless messages with GCP support before we found what GCP was doing with the The pain of renaming the default OSS lease is pretty small. |
/area vertical-pod-autoscaler |
Just thinking out loud - what is the worst that can happen when changing a lease name? On upgrade, we would have two For a short period of time, both of them will try to compute and apply VPA recommendations. Off the top of my head, these should all generally be the same recommendations, we will just have the possibility of racing/duplication. Is there any other risk anyone else can think of? |
Yup! That is my thought too.
Correct! My understanding is that the bad thing that could happen is that 2 VPA recommenders should be giving roughly the same recommendation, for a very short period of time, after which only 1 will be active. And, the VPA recommender's |
@ialidzhikov what do you think? My vote is to change it now before the next release (we could even consider a cherrypick here) given that:
|
cc @voelzmo as well |
Can maybe something go wrong with the checkpoint? If the new version leader writes a checkpoint that the old version leader doesn't understand perhaps? EDIT: Looks like we have support for this case. |
I agree with all these points. If we're going to change the lease name, I think now is the perfect time to do so. |
Hi folks,
The leader election resource name and namespace are configurable. If you are installing a custom VPA to a GKE cluster, please use the |
I am also open to rename the default lease name in the VPA repo to avoid this issue. |
Alright, as it's still new and it's an easy way to avoid issues before too many people use it. I guess changing it now is fine. |
We'll need to update this: https://github.com/cowboysysop/charts/blob/master/charts/vertical-pod-autoscaler/templates/recommender/clusterrole.yaml#L141-L142 which was added in cowboysysop/charts#705. If we combine it with a release then this should be less painful. |
Opened cowboysysop/charts#781 to update the Helm chart. |
…se" to avoid conflicts See kubernetes/autoscaler#7461. The default lock name can sometimes conflict with a managed deployment of VPA/HPA which can cause issues on your cluster. Here we are proposing changing the flag value in the Helm chart to a new name (`vpa-recommender-lease`). We are keeping the old resource name in the RBAC to avoid disruptions or issues during upgrade.
A summery of where we are with this:
We should try get the bottom two items done before cutting a release of the VPA |
I don't think we need to. Helm charts decide when/how to pick up new upstream releases on their own, right? Is there any reason why a vpa release does depend on changes made in helm charts? |
There is certainly no hard dependency, but I worry that if someone decides to bump the Helm chart before merging in the lease rename PRs, then users of that Helm chart may have a broken VPA. I don't think we have to wait, but I think it would be a nice thing to do (with some friendly nudges to the Helm chart maintainers if PRs aren't merged). Basically, we're breaking a promise we had with them, let's try handle the name change as gracefully as possible. |
@adrianmoisey speaking as the maintainer of the On to the wider issue here, is there a reason why the lease name wasn't made an optional arg? This would have the least impact on all of the existing VPA users, most of whom are unlikely to be on GCP? And also is there a reason why if the change was being made that it wasn't made consistently across all the components? Nothing makes long term maintenance harder than unexpected inconsistency. |
Good to know, thanks!
The lease functionality was defaulted to "off", and the lease name was an arg, with a default set.
What do you mean? The lease was rolled out for all 3 VPA components. |
@adrianmoisey sorry I missed the original state of the system regarding existing args, but that leads me to question why a code change was required at all? I can see why support for using an alternate lease name would be useful, but it looks to me like this could be a manifest only change? And I'm not sure I understand why the default needs to change rather than document the edge case? My Helm chart can (and will) easily support modifying the default lease names.
I can only see a change to the default name for the recommender in #7498, are there other PRs for the other components to add the |
There were a few factors into the decision:
We basically concluded that the pain of changing the lease name now was lower than the pain of someone having troubles when running on GKE.
Those names don't conflict with GKE, so there's no need to change them. |
I can see that it's easier, but is it correct? This looks like a GKE issue and what's to stop them from modifying their deployment to change their lease name if they're tracking the changes in this repo blindly? For managed components they should, at a minimum have a unique lease defined for this very reason.
I think this is a mistake if you're making a change, skipping changing the others lowers the complexity today (one off write cost) but increases it for the life of the project (perpetual read cost). I would suggest that the lease names should be aligned across all components. Anway, and please don't take my feedback the wrong way, I'll make sure to update the Helm chart when the next VPA release is out. I'll likely make the lease name configurable so even if GKE takes the new name there will be a way to work around it. |
Which component are you using?:
vertical-pod-autoscaler
What version of the component are you using?:
Component version:
vertical-pod-autoscaler-1.2.0
+Leader election functionality was added in #6985 and is turned off by default
What k8s version are you using (
kubectl version
)?:Any version 1.27+
What environment is this in?:
GKE
What did you expect to happen?:
The self-deployed VPA recommender and the GKE implementation of HPA to continue working.
What happened instead?:
Both the self-deployed VPA recommender and the GKE version use a lease called
vpa-recommender
inkube-system
.If you deploy your own VPA recommender, it might "steal" the lease and prevent the GKE implementation of HPA.
How to reproduce it (as minimally and precisely as possible):
vpa-up.sh
). Make sure leader election is enabled (leader-elect=true
).Anything else?
This is due to the unfortunate naming collision between GKE's system controller (also called
vpa-recommender
and the one provided here)The text was updated successfully, but these errors were encountered: