Stop and start applications

You can stop running applications by using Tanzu Platform hub or the Tanzu CLI, for example for bug fixing or troubleshooting purposes. You can then subsequently start the application again.

Note

Stopping an application stops all the application instances across all Availability Targets. You must then manually start the application again. If you want to restart an application so that it stops and then starts again immediately, see Restart applications.

For information about how to build and deploy and application to a Space, see Build and deploy an application from source.

Stop a running application

After you deploy an application to a Space, stopping a running application stops all of the application instances across all Availability Targets.

  1. Stop the application.

    You can stop a running application using Tanzu Platform hub, Tanzu CLI, or kubectl.

    UI-based steps
    Do the following in Tanzu Platform hub:
    1. Set the project context to your project.
    2. On the left navigation pane, expand Application Spaces.
    3. Click Spaces and select your Space.
    4. Select the Applications tab and click on your application.
    5. Click Stop. A confirmation pop-up appears.
    6. Click Stop to submit.
    Tanzu CLI-based steps
    Use Tanzu CLI commands to stop the application instances.
    1. Make sure that your Space context is set correctly.

      tanzu project use PROJECT-NAME
      
      tanzu space use SPACE-NAME
      
    2. Stop the application.

      tanzu app stop <APP-NAME>
      
    kubectl-based steps
    You can also stop the application declaratively by updating the ContainerApp Kubernetes resource.
    1. From the context of your Space, get the kubeconfig.

      tanzu context current
      
    2. Copy the path to the kubeconfig from the Kube config: section of the output.

    3. Set your KUBECONFIG

      export KUBECONFIG=<COPIED-PATH>
      
    4. Edit the stopped field in the ContainerApp spec, setting it to true.

      kubectl edit containerapps.apps.tanzu.vmware.com CONTAINER-APP-NAME
      
    5. Add the following section to the spec:

      spec:
       ...
       stopped: true
       ...
      

      Save the changes. The system will notice this update and stop the application as a result.

    While the application is stopping, the application status changes to Stopping. After the application is stopped successfully across all instances, the status changes to Stopped. In case of failures, the status changes to DeployFailed.

  2. View the state of the application.

    As the application stop is requested, you can observe the state of the application in Tanzu Platform hub or using Tanzu CLI.

    UI-based steps
    Do the following in Tanzu Platform hub:
    1. Navigate to the application page in the same way as in the previous step.

      If the application is in the process of stopping, the status under the application name in the top left corner shows Stopping. If the application has stopped completely, it shows Stopped.

    2. Scroll down to the Applications Instances widget.

      If the application is in the process of stopping, you will see the current running instances. When the application has stopped completely, you will not see any application instances.

    Tanzu CLI-based steps
    Use Tanzu CLI commands to observe the state of the application.
    1. Set your Space context.

      tanzu project use PROJECT-NAME
      
      tanzu space use SPACE-NAME
      
    2. Observe the application status.

      tanzu app get <APP-NAME>
      

      If the application is in the process of stopping, the Status in the Overview section shows Stopping. If the application has stopped completely, the status shows Stopped. You can also use the tanzu app instances <APP-NAME> command to observe the details of the application instances while the application is stopping.

Start a previously stopped application

You can start the previously stopped application in a Space by using Tanzu Platform hub or the Tanzu CLI. Starting the application starts all the application instances across all Availability Targets.

  1. Start the stopped application

    You can start the previously stopped application using Tanzu Platform hub, Tanzu CLI, or kubectl.

    UI-based steps
    Do the following in Tanzu Platform hub:
    1. Set the project context to your project.
    2. On the left navigation pane, expand Application Spaces.
    3. Click Spaces and select your Space.
    4. Select the Applications tab and click on your application.
    5. Click Start. A confirmation pop-up appears.
    6. Click Start to submit.
    Tanzu CLI-based steps
    Use Tanzu CLI commands to start the application instances.
    1. Make sure that your Space context is set correctly.
    
       ```console
       tanzu project use PROJECT-NAME
    
    tanzu space use SPACE-NAME
    
    1. Start the application.

      tanzu app start <APP-NAME>
      
    kubectl-based steps
    You can also start the application declaratively by updating the ContainerApp Kubernetes resource.
    1. From the context of your Space, get the kubeconfig.

      tanzu context current
      
    2. Copy the path to the kubeconfig from the Kube config: section of the output.

    3. Set your KUBECONFIG

      export KUBECONFIG=<COPIED-PATH>
      
    4. Edit the stopped field in the ContainerApp spec, setting it to false.

      kubectl edit containerapps.apps.tanzu.vmware.com CONTAINER-APP-NAME
      
    5. Add the following section to the spec:

      spec:
       ...
       stopped: false
       ...
      

      Save the changes. The system will notice the update and start the application.

    While the application is being started, the application status changes to Deploying. After the application has started successfully across all instances, the status changes to Running. In case of failures, the status changes to DeployFailed.

  2. View the state of the application

    After you start the application, you can observe the state of the application in Tanzu Platform hub or by using the Tanzu CLI.

    UI-based steps
    Do the following in Tanzu Platform hub:
    1. Navigate to the application page in the same way as in the previous step.

      The status under the application name in the top left corner of the application page shows Deploying if the application is in the process of starting. Once the application has fully started, it shows Running.

    2. Scroll down to the Applications Instances widget.

      If the application is in the process of starting, you see the currently running instances. Once the application has fully started, you see all of the running application instances.

    Tanzu CLI-based steps
    Use Tanzu CLI commands to observe the state of the application.
    1. Set your Space context.

      tanzu project use PROJECT-NAME
      
      tanzu space use SPACE-NAME
      
    2. Observe the application status.

      tanzu app get <APP-NAME>
      

      If the application is in the process of starting, the status in the application Overview section shows Deploying. If the application has started fully, the status shows Running. You can also use the tanzu app instances <APP-NAME> command to observe details of the application instances after starting the application.

check-circle-line exclamation-circle-line close-line
Scroll to top icon