HAProxy Enterprise Kubernetes Ingress Controller Documentation 1.8

Use the Defaults custom resource

With the Defaults custom resource, you can manage default load balancer settings that apply to all services. To use it:

  1. Create a YAML file that declares a Defaults resource and add properties to its spec.config section.

    In the example below, the client_timeout property sets how many milliseconds the ingress controller will wait for an inactive client to respond.

    example-defaults.yaml

    apiVersion: "core.haproxy.org/v1alpha1"
    kind: Defaults
    metadata:
      name: example-defaults
      namespace: default
    spec:
      config:
        client_timeout: 10000
  2. Deploy it to your cluster using kubectl apply.

    $ kubectl apply -f example-defaults.yaml
    
  3. Create a new ConfigMap with the name haproxy-kubernetes-ingress to override the one that ships with the ingress controller. Add the cr-defaults key to the data section to implement the defaults.

    example-configmap.yaml

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: haproxy-kubernetes-ingress
      namespace: haproxy-controller
    data:
      cr-defaults: default/example-defaults
  4. Update the ConfigMap in your cluster by using kubectl apply.

    $ kubectl apply -f  example-configmap.yaml
    

Next up

Defaults custom resource reference
HAProxyConf 2022 - Call for papers