Define application defaults

This topic tells you how you set application-specific default runtime configuration on Tanzu Platform for Kubernetes.

Before you begin

Before you define application defaults, you must have a ContainerApp for your application. Create a ContainerApp by running:

tanzu app init

Set your application’s default number of instances

  • To set or change the default number of app instances per Space replica (Availability Target), run:

    tanzu app config scale set --app=<APP-NAME> instances=10
    

    Where <APP-NAME> references the ContainerApp name defined in tanzu app init. This argument is optional and defaults to the ContainerApp at the root of your current working directory if no app name is passed.

  • To delete your application’s default instance count, run:

    tanzu app config scale delete --app=<APP-NAME> instances
    

Set your application’s default CPU and memory limits

  • To set or change your application’s default CPU limit in each Space replica (Availability Target), run:

    tanzu app config scale set --app=<APP-NAME> cpu=10
    
  • To delete your application’s default CPU limit, run:

    tanzu app config scale delete --app=<APP-NAME> cpu
    
  • To set or change your application’s default memory limit in each Space replica (Availability Target), run:

    tanzu app config scale set --app=<APP-NAME> memory=500M
    

  • To delete your application’s default memory limit, run:

    tanzu app config scale delete --app=<APP-NAME> memory
    

Add, update, or remove non-secret environment variables

  • To set or change non-secret environment variables, run:

    tanzu app config env set --app=<app-name> KEY=VALUE
    
  • To delete a non-secret environment variable, run:

    tanzu app config env delete --app=<app-name> KEY
    

Add or remove accepted service bindings

  • To add an accepted service binding, run:

    tanzu app config servicebinding set --app=<app-name> <service-binding-type>=<service-binding-name>
    

    For example, to add an AcceptedServiceBindg for a mysql type service named my-db:

    tanzu app config servicebinding set --app=my-app mysql=my-db
    
  • To delete an accepted service binding, run:

    tanzu app config servicebinding delete --app=<app-name> <service-binding-type>
    

View local configuration

  • To get details about the local configuration of an application, run:

    tanzu app config get --app=<app-name>
    
check-circle-line exclamation-circle-line close-line
Scroll to top icon