F5 Container Integrations v1.1

Current Page

Application Services Proxy

Cloud Foundry

Kubernetes

Mesos Marathon

OpenShift

Support

Troubleshooting

Tutorials

Cloud Docs Home > F5 Container Integrations Index

Attach an ASP to a Kubernetes Service

Summary

The Application Services Proxy (ASP) watches Kubernetes Service definitions for a set of annotations defining virtual server objects.
The annotation should include a JSON blob defining of a set of ASP configuration parameters. When you add the ASP annotation to a Kubernetes Service, the ASP creates a virtual server for that Service.

Annotate a Kubernetes Service

Use one of the options below to attach an ASP to a Kubernetes Service.

  1. Annotate the Service definition with the key-value pair asp.f5.com/config="<JSON-config-blob>".

    Important

    When you annotate the Service this way, you must encode the JSON config blob as shown in the example below (escape all quotes – \").

    user@k8s-master:~$ kubectl annotate service example-service asp.f5.com/config="{\"ip-protocol\":\"http\",\"load-balancing-mode\":\"round-robin\"}"
    service "example-service" annotated
    
  2. Edit the Service definition and add the annotation section with the ASP configurations.

    user@k8s-master:~$ kubectl edit service example-service
    
     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
    apiVersion: v1
    kind: Service
    metadata:
      annotations:
        # provide the desired ASP config parameters as a JSON blob
        asp.f5.com/config: |
          {
            "ip-protocol": "http",
            "load-balancing-mode": "round-robin",
            "flags" : {
              "x-forwarded-for": true,
              "x-served-by": true
            }
          }
      labels:
        # the name of the Service
        name: myService
      # the name of the Service
      name: myService
      # the namespace of the Service you want to proxy; the ASP pod will be
      # created in this namespace
      namespace: default
    spec:
      selector:
        # once again, the name of the Service
        app: myService
      type: NodePort
      ports:
        - name: "http"
          protocol: TCP
          port: 80
    
    

    Download an example Service definition with the ASP annotation

  3. (Optional) Verify that the ASP handles traffic for the Service