How to enable auto scaling in PCF application using manifest.yaml file

I want to enable autoscaling for my PCF deployed spring boot application. I have created an App autoscaler service directly in the Apps Manager for the PCF space on which the application is deployed. I am binding the service to the application using manifest.yaml file. The service gets bounded to the application but it is not enabled upon deployment. I also need to set the instance limit max and min values but facing error during deployment via Jenkins build.

I tried with the below manifest.yaml file.

...
...
dev:
  pcf_urls: ["abc.dev.com"]
  pcf_space: "dev"
  pcf_env:"dev"
  pcf_buildpack: java_buildpack
  pcf_bindServices:
    - "mycredhubservice"
    - "myappautoscaler"
  applications:
  - name: my-app
    instances: 1
    memory: 1G
    env:
       SPRING_PROFILES_ACTIVE: dev
       ...
       ...
    services:
      - name: mycredhubservice 
      - name: myappautoscaler 
        parameters:
          instance_min_count: 1
          instance_max_count: 3

The deployment of the application fails with the above configuration. The error details 'For service "myappautoscaler": Service broker error: All top level service binding parameters are required.'

I need to enable autoscaling for the application via the manifest.yaml that is used to deploy the application in PCF. Thanks !

Upvotes: 0

Views: 596

Answers (1)

indika
indika

Reputation: 66

You need to configure, and set rules in your autoscaler. You can do that through CLI or YML. The YML will look like something below.

---
instance_limits:
  min: LOWER-SCALING-LIMIT
  max: UPPER-SCALING-LIMIT
rules:
- rule_type: RULE-TYPE
  threshold:
    min: MINIMUM-METRIC-THRESHOLD
    max: MAXIMUM-METRIC-THRESHOLD
scheduled_limit_changes:
- recurrence: RECURRENCE
  executes_at: "TIME"
  instance_limits:
    min: SCHEDULED-LOWER-SCALING-LIMIT
    max: SCHEDULED-UPPER-SCALING-LIMIT

See here for the documentation: https://docs.vmware.com/en/VMware-Tanzu-Application-Service/6.0/tas-for-vms/autoscaler-using-autoscaler-cli.html

Upvotes: 1

Related Questions