To attach an ASP to a Kubernetes Service, add an Annotation containing the ASP configurations. You can use either the annotate CLI command or edit the Service definition.

Tip

The annotate command is better suited to adding shorter annotations, like that shown in the example below.
If you intend to add event handlers, health checks, and/or flags, you may want to edit the Service definition directly.

apiVersion:v1kind:Servicemetadata:annotations:# provide the desired ASP config parameters as a JSON blob# The JSON below provides examples for the ASP virtual server configuration# parameters available in v1.1.0asp.f5.com/config:|{"ip-protocol":"http","load-balancing-mode":"round-robin","event-handlers":[{"http-request":"module.exports = (req, res, next) => {\n if (req.method === 'POST') {\n res.statusCode = 503;\n res.end('POST Method not supported');\n } else { \n next(); \n } \n}\n"},{"http-response":"module.exports = (res, next) => { res.headers['x-my-bar'] = 'foo'; next(); }"}],"flags":{"x-forwarded-for":true,"x-served-by":true},"health-monitor":{"health-checks":{"srv1-check":{"default-state":"unknown","active":{"timeout":10,"interval":10,"up-count":2,"down-count":3,"http":{"path":"/healthz"}}}}},}labels:# the name of the Servicename:myService# the name of the Servicename:myService# the namespace of the Service you want to proxy; the ASP pod will be# created in this namespacenamespace:defaultspec:selector:# once again, the name of the Serviceapp:myServicetype:NodePortports:-name:"http"protocol:TCPport:80

Because each ASP instance (one per Node) shares the same global configurations, Service endpoints will receive health probes from all of the ASP instances. The ASP can use a health probe sharding algorithm to reduce probe redundancy.

This algorithm allocates a subset of endpoints to each ASP instance. Each ASP instance adds the health data for its assigned endpoints to the ephemeral store, giving all ASP instances access to the data for all endpoints.