This is a cache of https://docs.openshift.com/container-platform/4.11/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-aws.html. It is a snapshot of the page at 2024-11-22T14:35:10.360+0000.
Configuring <strong>ingress</strong> cluster traffic on AWS - Configuring <strong>ingress</strong> cluster traffic | Networking | OpenShift Container Platform 4.11
×

OpenShift Container Platform provides methods for communicating from outside the cluster with services running in the cluster. This method uses load balancers on AWS, specifically a Network Load Balancer (NLB) or a Classic Load Balancer (CLB). Both types of load balancers can forward the client’s IP address to the node, but a CLB requires proxy protocol support, which OpenShift Container Platform automatically enables.

You can configure these load balancers on a new or existing AWS cluster.

Configuring Classic Load Balancer timeouts on AWS

OpenShift Container Platform provides a method for setting a custom timeout period for a specific route or ingress Controller. Additionally, an AWS Classic Load Balancer (CLB) has its own timeout period with a default time of 60 seconds.

If the timeout period of the CLB is shorter than the route timeout or ingress Controller timeout, the load balancer can prematurely terminate the connection. You can prevent this problem by increasing both the timeout period of the route and CLB.

Configuring route timeouts

You can configure the default timeouts for an existing route when you have services in need of a low timeout, which is required for Service Level Availability (SLA) purposes, or a high timeout, for cases with a slow back end.

Prerequisites
  • You need a deployed ingress Controller on a running cluster.

Procedure
  1. Using the oc annotate command, add the timeout to the route:

    $ oc annotate route <route_name> \
        --overwrite haproxy.router.openshift.io/timeout=<timeout><time_unit> (1)
    1 Supported time units are microseconds (us), milliseconds (ms), seconds (s), minutes (m), hours (h), or days (d).

    The following example sets a timeout of two seconds on a route named myroute:

    $ oc annotate route myroute --overwrite haproxy.router.openshift.io/timeout=2s

Configuring Classic Load Balancer timeouts

You can configure the default timeouts for a Classic Load Balancer (CLB) to extend idle connections.

Prerequisites
  • You must have a deployed ingress Controller on a running cluster.

Procedure
  1. Set an AWS connection idle timeout of five minutes for the default ingresscontroller by running the following command:

    $ oc -n openshift-ingress-operator patch ingresscontroller/default \
        --type=merge --patch='{"spec":{"endpointPublishingStrategy": \
        {"type":"LoadBalancerService", "loadBalancer": \
        {"scope":"External", "providerParameters":{"type":"AWS", "aws": \
        {"type":"Classic", "classicLoadBalancer": \
        {"connectionIdleTimeout":"5m"}}}}}}}'
  2. Optional: Restore the default value of the timeout by running the following command:

    $ oc -n openshift-ingress-operator patch ingresscontroller/default \
        --type=merge --patch='{"spec":{"endpointPublishingStrategy": \
        {"loadBalancer":{"providerParameters":{"aws":{"classicLoadBalancer": \
        {"connectionIdleTimeout":null}}}}}}}'

You must specify the scope field when you change the connection timeout value unless the current scope is already set. When you set the scope field, you do not need to do so again if you restore the default timeout value.

Configuring ingress cluster traffic on AWS using a Network Load Balancer

OpenShift Container Platform provides methods for communicating from outside the cluster with services that run in the cluster. One such method uses a Network Load Balancer (NLB). You can configure an NLB on a new or existing AWS cluster.

Replacing ingress Controller Classic Load Balancer with Network Load Balancer

You can replace an ingress Controller that is using a Classic Load Balancer (CLB) with one that uses a Network Load Balancer (NLB) on AWS.

This procedure causes an expected outage that can last several minutes due to new DNS records propagation, new load balancers provisioning, and other factors. IP addresses and canonical names of the ingress Controller load balancer might change after applying this procedure.

Procedure
  1. Create a file with a new default ingress Controller. The following example assumes that your default ingress Controller has an External scope and no other customizations:

    Example ingresscontroller.yml file
    apiVersion: operator.openshift.io/v1
    kind: ingressController
    metadata:
      creationTimestamp: null
      name: default
      namespace: openshift-ingress-operator
    spec:
      endpointPublishingStrategy:
        loadBalancer:
          scope: External
          providerParameters:
            type: AWS
            aws:
              type: NLB
        type: LoadBalancerService

    If your default ingress Controller has other customizations, ensure that you modify the file accordingly.

  2. Force replace the ingress Controller YAML file:

    $ oc replace --force --wait -f ingresscontroller.yml

    Wait until the ingress Controller is replaced. Expect serveral of minutes of outages.

Configuring an ingress Controller Network Load Balancer on an existing AWS cluster

You can create an ingress Controller backed by an AWS Network Load Balancer (NLB) on an existing cluster.

Prerequisites
  • You must have an installed AWS cluster.

  • PlatformStatus of the infrastructure resource must be AWS.

    • To verify that the PlatformStatus is AWS, run:

      $ oc get infrastructure/cluster -o jsonpath='{.status.platformStatus.type}'
      AWS
Procedure

Create an ingress Controller backed by an AWS NLB on an existing cluster.

  1. Create the ingress Controller manifest:

     $ cat ingresscontroller-aws-nlb.yaml
    Example output
    apiVersion: operator.openshift.io/v1
    kind: ingressController
    metadata:
      name: $my_ingress_controller(1)
      namespace: openshift-ingress-operator
    spec:
      domain: $my_unique_ingress_domain(2)
      endpointPublishingStrategy:
        type: LoadBalancerService
        loadBalancer:
          scope: External(3)
          providerParameters:
            type: AWS
            aws:
              type: NLB
    1 Replace $my_ingress_controller with a unique name for the ingress Controller.
    2 Replace $my_unique_ingress_domain with a domain name that is unique among all ingress Controllers in the cluster. This variable must be a subdomain of the DNS name <clustername>.<domain>.
    3 You can replace External with Internal to use an internal NLB.
  2. Create the resource in the cluster:

    $ oc create -f ingresscontroller-aws-nlb.yaml

Before you can configure an ingress Controller NLB on a new AWS cluster, you must complete the Creating the installation configuration file procedure.

Configuring an ingress Controller Network Load Balancer on a new AWS cluster

You can create an ingress Controller backed by an AWS Network Load Balancer (NLB) on a new cluster.

Prerequisites
  • Create the install-config.yaml file and complete any modifications to it.

Procedure

Create an ingress Controller backed by an AWS NLB on a new cluster.

  1. Change to the directory that contains the installation program and create the manifests:

    $ ./openshift-install create manifests --dir <installation_directory> (1)
    1 For <installation_directory>, specify the name of the directory that contains the install-config.yaml file for your cluster.
  2. Create a file that is named cluster-ingress-default-ingresscontroller.yaml in the <installation_directory>/manifests/ directory:

    $ touch <installation_directory>/manifests/cluster-ingress-default-ingresscontroller.yaml (1)
    1 For <installation_directory>, specify the directory name that contains the manifests/ directory for your cluster.

    After creating the file, several network configuration files are in the manifests/ directory, as shown:

    $ ls <installation_directory>/manifests/cluster-ingress-default-ingresscontroller.yaml
    Example output
    cluster-ingress-default-ingresscontroller.yaml
  3. Open the cluster-ingress-default-ingresscontroller.yaml file in an editor and enter a custom resource (CR) that describes the Operator configuration you want:

    apiVersion: operator.openshift.io/v1
    kind: ingressController
    metadata:
      creationTimestamp: null
      name: default
      namespace: openshift-ingress-operator
    spec:
      endpointPublishingStrategy:
        loadBalancer:
          scope: External
          providerParameters:
            type: AWS
            aws:
              type: NLB
        type: LoadBalancerService
  4. Save the cluster-ingress-default-ingresscontroller.yaml file and quit the text editor.

  5. Optional: Back up the manifests/cluster-ingress-default-ingresscontroller.yaml file. The installation program deletes the manifests/ directory when creating the cluster.

Additional resources