F5 Container Integrations v1.2

Current Page

Application Services Proxy

Cloud Foundry

Kubernetes

Mesos Marathon

OpenShift

Support

Troubleshooting

Tutorials

Cloud Docs Home > F5 Container Integrations Index

Create an ASP for a Marathon Application

The F5 ASP Controller for Marathon launches Application Services Proxy instances automatically for Apps that have the ASP_ENABLE_LABEL value set to “enabled” (for example, f5-asp:enable).

Launch an ASP instance with the default configurations

Add the label "f5-asp": "enable" to the App’s service definition.

  1. Via the Marathon web interface:

    • Click on the App name in the Applications list.
    • Click Configuration.
    • Click Edit.
    • Click Labels.
    • Click the + icon and add the label “f5-asp: enable”.
    • Click Change and deploy configuration.
  2. Via the REST API:

    • Edit the App definition
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    // REMOVE ALL COMMENTS FROM THIS FILE BEFORE USING
    {
      "container": {
        "docker": {
          "portMappings": [
            {
              "servicePort": 11099,
              "protocol": "tcp",
              "containerPort": 80,
              "hostPort": 0
            }
          ],
          "privileged": false,
          "image": "<my-app-image:version>",
          "network": "BRIDGE",
          "forcePullImage": true
        },
        "type": "DOCKER",
        "volumes": []
      },
      "mem": 128,
      // The label below activates the ASP with the default configurations
      "labels": {
        "f5-asp": "enable"
      },
      "cpus": 0.25,
      "instances": 1,
      "upgradeStrategy": {
        "maximumOverCapacity": 1,
        "minimumHealthCapacity": 1
      },
      "id": "demo-app"
    }
    
    • Send a PUT request to the Marathon API server to update the App.
    $ curl -X PUT -H "Content-Type: application/json" http://10.190.25.75:8080/v2/apps/basic-0 -d @app_asp-enabled-defaults.json
    

Launch an ASP instance with custom configurations

Add the label "f5-asp": "enable" to the App’s service definition.

  1. Via the Marathon web interface:

    • Click on the App name in the Applications list.
    • Click Configuration.
    • Click Edit.
    • Click Labels.
    • Click the plus sign icon and add your override labels.
    • Click Change and deploy configuration.
  2. Via the REST API:

    • Add your desired override labels to the App’s service definition.

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      // REMOVE ALL COMMENTS FROM THIS FILE BEFORE USING
      {
        "container": {
          "docker": {
            "portMappings": [
              {
                // This service port will be the ASP's host port; make sure it is
                // an available port
                "servicePort": 11099,
                "protocol": "tcp",
                "containerPort": 80,
                "hostPort": 0
              }
            ],
            "privileged": false,
            "image": "<my-app-image:version",
            "network": "BRIDGE",
            "forcePullImage": true
          },
          "type": "DOCKER",
          "volumes": []
        },
        "mem": 128,
        // The labels below activate and configure the ASP
        "labels": {
          "f5-asp": "enable",
          "ASP_LOG_LEVEL": "debug",
          "ASP_VS_KEEP_ALIVE": 50,
          "ASP_VS_FLAGS": {
            "x-forwarded-for": true,
            "x-forwarded-by": true
          },
          "ASP_COUNT_PER_APP": 2
        },
        "cpus": 0.25,
        "instances": 1,
        "upgradeStrategy": {
          "maximumOverCapacity": 1,
          "minimumHealthCapacity": 1
        },
        "id": "demo-app-custom"
      }
      
    • Send a PUT request to the Marathon API server to update the App definition.

      $ curl -X PUT -H "Content-Type: application/json" http://<marathon-url>:8080/v2/apps -d @app_asp-enabled-custom.json