This document is intended for application owners that run Google Distributed Cloud. This document shows you how to manage the power state of virtual machines (VMs) that use VM Runtime on GDC.
You can stop, start, and restart VMs as needed to support the lifecycle of your applications. For example, you may want to change the number of assigned vCPUs or amount of memory. After you edit the configuration of your VM, you must cycle the power state to apply the changes.
Before you begin
To complete this document, you need access to the following resources:
- A VM that runs in one of your clusters. If needed, create a VM in Google Distributed Cloud.
- The
virtctlclient tool installed as a plugin forkubectl. If needed, install the virtctl client tool.
Stop a VM
When you stop a VM, compute resources such as CPU and memory are freed from the underlying host. The VM is shut down.
To stop a VM that's in a running state, use the following steps.
Use
kubectlto stop a VM:kubectl virt stop VM_NAMEReplace
VM_NAMEwith the name of the VM that you want to stop.Check the
STATUSof your VM:kubectl get gvm VM_NAMEThe following example output shows the VM in a
Stoppedstate:NAME STATUS AGE IP vm1 Stopped 1m 192.168.2.72
Start a VM
To start a VM that's in a stopped state, use the following steps.
Use
kubectlto start a VM:kubectl virt start VM_NAMEReplace
VM_NAMEwith the name of the VM that you want to start.Check the
STATUSof your VM:kubectl get gvm VM_NAMEThe following example output shows the VM in a
Runningstate:NAME STATUS AGE IP vm1 Running 1m 192.168.2.72
Restart a VM
To restart a VM that's in a running state, use the following steps.
Use
kubectlto restart a VM:kubectl virt restart VM_NAMEReplace
VM_NAMEwith the name of the VM that you want to restart.Check the
STATUSof your VM:kubectl get gvm VM_NAMEThe following example output shows the VM in a
Stoppingstate:NAME STATUS AGE IP vm1 Stopping 7s 192.168.2.72Check the
STATUSof your VM again after a minute or two:kubectl get gvm VM_NAMEAfter the VM has successfully restarted, the following example output shows the VM in a
Runningstate again:NAME STATUS AGE IP vm1 Running 1m 192.168.2.73This example VM uses an ephemeral pod IP address, so the address changes when the VM restarts.
What's next
- Edit a VM in Google Distributed Cloud.
- When you no longer need VMs, Delete a VM in Google Distributed Cloud.