https://pulumi.com logo
#general
Title
# general
r

refined-printer-32244

01/31/2023, 6:41 PM
is it possible in pulumi to tell it to only shut down one or two VMs at a time in a group of VMs? for example, if I'm using it to manage the VMs for a kubernetes cluster to tell it to only take down 2 of 6 machines at a time so the whole cluster isn't down?
b

billowy-army-68599

01/31/2023, 6:58 PM
Unfortunately, not really. Pulumi drives towards a desired state, and shutting down instances is an imperative action. However, it sounds like you maybe want to do a rolling upgrade on your Kubernetes nodes? there are solutions to that problem we can implement
r

refined-printer-32244

01/31/2023, 7:04 PM
yeah, a rolling update would be great! i had the idea of a pulumi option I could pass to the resources to say "these are related so wait for some to come back before the others are taken down". in this case I was changing the number of cpus and memory available to the worker nodes, so it's not necessarily a kubernetes thing but it could be any cluster of machines.
i thought about making each vm dependent on the other to see if that would make them update in order
b

billowy-army-68599

01/31/2023, 7:08 PM
which cloud provider are you using? how are you building the cluster?
r

refined-printer-32244

01/31/2023, 7:11 PM
i'm using the vsphere provider in Go. I'm building the masters in a loop and then building the workers in a loop. all in the same pulumi stack
i'm creating them as `NewVirtualMachine`s
oh, and after creating them i'm using a separate ansible playbook to configure the nodes themselves with
k3s
as the Kubernetes distribution
b

billowy-army-68599

01/31/2023, 8:58 PM
ahh vmware. I believe (although I’m not an expert) you could use the cluster autoscaler and a pod disruption budget to achieve that
when you say
NewVirtualMachine
you’re doing them in a loop?
r

refined-printer-32244

01/31/2023, 11:35 PM
yeah, sorry. i had to step away. i have two loops in my custom "cluster create" method that each call
vsphere.NewVirtualMachine
to create either the master nodes (first loop) or the agent nodes (second loop). I'm not actually using any vmware kubernetes providers or implementation for this.
2 Views