After you deploy an application to a Space, you can restart the application by using Tanzu Platform hub or the Tanzu CLI.
NoteRestarting an application stops and then immediately restarts all the application instances across all Availability Targets. To stop an application without restarting it immediately, see Stop and start applications.
For information about how to build and deploy and application to a Space, see Build and deploy an application from source.
Restart the application
You can restart an application using Tanzu Platform hub, Tanzu CLI, or kubectl
.
build
plug-in by running:tanzu plugin upgrade build
Make sure that your project and Space context is set correctly.
tanzu project use PROJECT-NAME
tanzu space use SPACE-NAME
Restart the application.
tanzu app restart <APP-NAME>
kubectl
-based steps
From the context of your Space, get the kubeconfig
.
tanzu context current
Copy the path to the kubeconfig
from the Kube config:
section of the output.
Set your KUBECONFIG
export KUBECONFIG=<COPIED-PATH>
Edit the restartNonce
field in the ContainerApp
spec, setting it to a unique string. The string must be different than the currently applied string.
kubectl edit containerapps.apps.tanzu.vmware.com CONTAINER-APP-NAME
Add the following section to the spec:
spec:
...
restartNonce: "UNIQUE-STRING"
...
Save the changes. The system will notice this update and restart the app as a result.
During the restart, the application status changes to Deploying
. After the application is restarted successfully across all instances, the status changes to Running
/ DeploySucceeded
. In case of failures, the status changes to DeployFailed
.
View the state of each replica
As the restart is rolled out, you can observe the state of each replica in Tanzu Platform hub or by using Tanzu CLI.
See the Version status column for each instance.
The status is Up-to-date if the app has been restarted with the latest changes.
The status is Out-of-date if the restart is still being rolled out and an older version currently deployed.
Make sure that your project and Space context is set correctly.
tanzu project use PROJECT-NAME
tanzu space use SPACE-NAME
Observe the application instances.
tanzu app instances <APP-NAME>
See the VERSION-STATUS column for each instance.
The status is Up-to-date if the app has been restarted with the latest changes.
The status is Out-of-date if the restart is still being rolled out and an older version currently deployed.