HTTPRule
The developers are the primary users of the HTTPRule CRD. The path matching rules in the ingress or route objects define traffic routing rules to the microservices. The HTTPRule CRD can be used as a complimentary object to control additional layer 7 properties like algorithm, hash, and tls re-encrypt use cases.
With
AKO
version 1.11.1, AviInfrasetting is transitioned to version v1beta1
. There are no schema changes between version v1alpha1
and v1beta1
. AKO
1.11.1 supports both versions v1alpha1
andv1beta1
. However, it is recommended to create new CRD objects in v1beta1
and transition the existing objects to this version.AKO
will deprecate v1alpha1
in the upcoming releases.A sample HTTPRule object is as shown below:
apiVersion: ako.vmware.com/v1beta1kind: HTTPRule metadata: name: my-http-rule namespace: purple-l7 spec: fqdn: foo.avi.internal paths: - target: /foo healthMonitors: - my-health-monitor-1 - my-health-monitor-2 loadBalancerPolicy: algorithm: LB_ALGORITHM_CONSISTENT_HASH hash: LB_ALGORITHM_CONSISTENT_HASH_SOURCE_IP_ADDRESS tls: ## This is a re-encrypt to pool type: reencrypt # Mandatory [re-encrypt] sslProfile: avi-ssl-profile destinationCA: |- -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE-----
The HTTPRule only applies to paths in the Ingress/Route objects which are specified in the same namespace as the HTTPRule CRD.
Usage of the HTTPRule CRD
The HTTPRule CRD does not have any specific semantics for
Avi Load Balancer
. So, you are free to express your preferences using this CRD without any knowledge of theAvi Load Balancer
objects. Each HTTPRule CRD must be bound to an FQDN (both secure or insecure) to subscribe to rules for specific hostpath combinations.- Express Load Balancer AlgorithmThe load balancer policies are a predefined set of values to choose from.Currently, the following values are supported for load balancer policy:
- LB_ALGORITHM_CONSISTENT_HASH
- LB_ALGORITHM_CORE_AFFINITY
- LB_ALGORITHM_FASTEST_RESPONSE
- LB_ALGORITHM_FEWEST_SERVERS
- LB_ALGORITHM_LEAST_CONNECTION
- SLB_ALGORITHM_LEAST_LOAD
- LB_ALGORITHM_ROUND_ROBIN
To configure the load balancer policy for a given ingress path,- target: /foo loadBalancerPolicy: algorithm: LB_ALGORITHM_FEWEST_SERVERSThis rule is applied to all paths matching/fooand subsets of/foo/xxx. For more information, seeLoad Balancing Algorithmstopicin the. The hash field is used when the algorithm is selected asVMware Avi Load BalancerConfiguration GuideLB_ALGORITHM_CONSISTENT_HASH. Otherwise, it is not applicable. Similarly, ahostHeaderfield is used only when the hash is selected asLB_ALGORITHM_CONSISTENT_HASH_CUSTOM_HEADER. A sample setting with these fields is shown below:- target: /foo loadBalancerPolicy: algorithm: LB_ALGORITHM_CONSISTENT_HASH hash: LB_ALGORITHM_CONSISTENT_HASH_CUSTOM_HEADER hostHeader: fooThe hostHeader is disregarded if it is specified in any other case. The hash field is disregarded if the algorithm is notLB_ALGORITHM_CONSISTENT_HASH. - Express Application Persistence ProfileHTTPRule CRD can be used to express application persistence profile references. Create the application persistence profile reference in theAvi Load Balancer Controllerprior to this CRD creation.applicationPersistence: cookie-userid-persistenceThe application persistence profile can be used to maintain stickiness to a server instance based on cookie values, headers, and so on, for a desired duration of time.
- Express Health MonitorsThe HTTPRule CRD can be used to express health monitor references.Create the health monitor reference in theAvi Load Balancer Controllerprior to this CRD creation.To express health monitor references, use:healthMonitors: - my-health-monitor-1 - my-health-monitor-2The health monitors can be used to verify server health. A server (Kubernetes pods in this case) is marked as UP only when all the health monitors return successful responses. Health monitors provided here overwrite the default health monitor configuration set byAKO, that is,System-TCPfor HTTP/TCP traffic andSystem-UDPfor UDP traffic based on the ingress/service configuration.
- Re-encrypt Traffic to the ServicesWhileAKOcan terminate TLS traffic, it also provides an option where the users can choose to re-encrypt the traffic between theAvi Load BalancerSE and the backend application server. The following option is provided for re-encrypt one is by providing a raw certificate usingdestinationCAor by providing anAvi Load BalancerPKI Profile reference using thepkiProfilefield:tls: ## This is a re-encrypt to pool type: reencrypt # Mandatory [re-encrypt] sslProfile: avi-ssl-profile destinationCA: |- -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- tls: ## This is a re-encrypt to pool type: reencrypt # Mandatory [re-encrypt] sslProfile: avi-ssl-profile pkiProfile: avi-pki-profileThesslProfile, additionally, can be used to determine the set of SSL versions and ciphers to accept for SSL/TLS terminated connections. If thesslProfileis not defined,AKOdefaults tosslProfileSystem-Standard defined inAvi Load Balancer.If re-encrypt occurs, if thedestinationCAis specified in the HTTP Rule CRD, as shown in the example, a corresponding PKI profile is created for that pool (host path combination). Also note that only one of PKI profile or destination CA can be provided to configure re-encrypt for a pool corresponding to the host path backend Service.
- Enable HTTP/2 protocol support for backendHTTPRule custom resource can be used to enable HTTP/2 traffic support to the backend for L7 virtual services. To do so, the user must set theenableHTTP2field totruefor the specific FQDN and path.AKOwill then enable HTTP/2 traffic support for the corresponding backend pool.A sample setting with this field is shown below:- target: /foo enableHTTP2: trueThis field must be used along with an Aviinfrasetting custom resource object to enable end-to-end HTTP/2 traffic flow between client and server. The Aviinfrasetting custom resource can enable HTTP/2 protocol support on front-end ports opened for L7 Shared or Dedicated virtual services. For more information, see Custom Ports in theAviInfraSettingtopic.network: null listeners: - enableHTTP2: true enableSSL: true port: 443This property is available only in the HTTPRule v1beta1 schema definition.
- Status MessagesThe status messages are used to give instant feedback on whether a HTTPRule CRD was accepted or rejected.
- Example of a HTTP Rule$ kubectl get httprule NAME HOSTRULE STATUS AGE my-http-rules default/secure-waf-policy Accepted 5h34m