AS3 Configmap: Multiple Apps in Single Partition - Single Virtual Address

Description: This section will cover some best practices, tips, and caveats when configuring multiple apps (virtual servers) in the AS3 declaration. In this scenario, an application owner wants to configure multiple applications that may use different protocols. The tenant/partition will be the same. For more examples, see F5 DevCentral f5-k8s-demo repository.

Prerequisites: - Basic understanding REST APIs and declarative configuration.

Diagrams:

mod-4-1

Summary

You can declare multiple applications (virtual servers) in a single partition/tenant.

  1. Define one tenant
  2. Define one virtual address in a Shared application block
  3. Define first application in the tenant block referencing above virtual address using "use"
  4. Similarly, define second application in the same tenant block
 kind: ConfigMap
 apiVersion: v1
 metadata:
 name: f5-as3-declaration1
 namespace: kube-system
 labels:
     f5type: virtual-server
     as3: "true"
 data:
 template: |
     {
         "class": "AS3",
         "declaration": {
             "class": "ADC",
             "schemaVersion": "3.18.0",
             "id": "testapp",
             "label": "Two HTTP VS with one VIP",
             "remark": "example",
             "Tenant0": {
                 "class": "Tenant",
                 "Shared": {
                     "class": "Application_Shared",
                     "template":"shared",
                     "serviceAddress0": {
                         "class": "Service_Address",
                         "virtualAddress": "10.1.10.81",
                         "trafficGroup": "/Common/traffic-group-1"
                     }
                 },
                 "App1": {
                     "class": "Application",
                     "template": "http",
                     "serviceMain": {
                         "class": "Service_HTTP",
                         "virtualAddresses": [{ "use": "/Tenant0/Shared/serviceAddress0"}],
                         "virtualPort": 80,
                         "pool": "nginx_pool1"
                     },
                     "nginx_pool1": {
                         "class": "Pool",
                         "monitors": [
                             "http"
                         ],
                         "members": [
                             {
                                 "servicePort": 80,
                                 "serverAddresses": [],
                                 "shareNodes": true
                             }
                         ]
                     }
                 },
                 "App2": {
                     "class": "Application",
                     "template": "http",
                     "serviceMain": {
                         "class": "Service_HTTP",
                         "trafficGroup": "traffic-group-1",
                         "virtualAddresses": [{ "use": "/Tenant0/Shared/serviceAddress0"}],
                         "virtualPort": 8080,
                         "pool": "nginx_pool2"
                     },
                     "nginx_pool2": {
                         "class": "Pool",
                         "monitors": [
                             "http"
                         ],
                         "members": [
                             {
                                 "servicePort": 80,
                                 "serverAddresses": [],
                                 "shareNodes": true
                             }
                         ]
                     }
                 }
             }
         }
     }

Confirm BIG-IP Objects:

  • Two Virtual Servers listening on different ports in the same partition (Tenant0)

    mod-4-2

  • One Virtual IP in traffic-group-1

    mod-4-3

  • Two pools associated with each Virtual Server

    mod-4-4

  • The nodes (pool member IPs) are automatically discovered and placed in the /Common partition

    mod-4-5