HAProxy Kubernetes Ingress Controller Documentation 1.10

Defaults CRD

The Defaults custom resource extends the Kubernetes API to let you manage default load balancer settings that apply to all services.

Install the Defaults custom resource

Before you can use the Defaults custom resource, you must install its definition into your Kubernetes cluster.

  1. Install the custom resource definition with kubectl apply:

    Community ingress controller

    $ kubectl apply -f https://cdn.haproxy.com/documentation/kubernetes/1.10/community/crd/defaults.yaml
  2. Verify that the installation worked by listing custom resources defined in your cluster:

    $ kubectl get crd

    output

    NAME                        CREATED AT
    defaults.core.haproxy.org   2022-06-01T16:56:57Z
    

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

Defaults custom resource reference

Version: core.haproxy.org/v1alpha2

abortonclose

Type Values
string enabled, disabled

accept_invalid_http_request

Type Values
string enabled, disabled

accept_invalid_http_response

Type Values
string enabled, disabled

adv_check

Type Values
string ssl-hello-chk, smtpchk, ldap-check, mysql-check, pgsql-check, tcp-check, redis-check, httpchk

allbackups

Type Values
string enabled, disabled

backlog

Type Values
integer

balance

Type Values
object

Child properties

Property Type Values
algorithm string roundrobin, static-rr, leastconn, first, source, uri, url_param, hdr, random, rdp-cookie
hdr_name string
hdr_use_domain_only boolean
random_draws integer
rdp_cookie_name string
uri_depth integer
uri_len integer
uri_path_only boolean
uri_whole boolean
url_param string
url_param_check_post integer
url_param_max_wait integer

bind_process

Type Values
string

check_timeout

Type Values
integer

clflog

Type Values
boolean

client_fin_timeout

Type Values
integer

client_timeout

Type Values
integer

clitcpka

Type Values
string enabled, disabled

compression

Type Values
object

Child properties

Property Type Values
algorithms array
offload boolean
types array

connect_timeout

Type Values
integer

contstats

Type Values
string enabled
Type Values
object

Child properties

Property Type Values
domain array
dynamic boolean
httponly boolean
indirect boolean
maxidle integer
maxlife integer
name string
nocache boolean
postonly boolean
preserve boolean
secure boolean
type string rewrite, insert, prefix

default_backend

Type Values
string

default_server

Type Values
object

Child properties

Property Type Values
address string
agent-addr string
agent-check string enabled, disabled
agent-inter integer
agent-port integer
agent-send string
allow_0rtt boolean
alpn string
backup string enabled, disabled
ca_file string
check string enabled, disabled
check-send-proxy string enabled, disabled
check-sni string
check-ssl string enabled, disabled
check_alpn string
check_proto string
check_via_socks4 string enabled, disabled
ciphers string
ciphersuites string
cookie string
crl_file string
disabled string enabled, disabled
downinter integer
enabled string enabled, disabled
error_limit integer
fall integer
fastinter integer
force_sslv3 string enabled, disabled
force_tlsv10 string enabled, disabled
force_tlsv11 string enabled, disabled
force_tlsv12 string enabled, disabled
force_tlsv13 string enabled, disabled
health_check_port integer
init-addr string
inter integer
log_proto string legacy, octet-count
max_reuse integer
maxconn integer
maxqueue integer
minconn integer
name string
namespace string
no_sslv3 string enabled, disabled
no_tlsv10 string enabled, disabled
no_tlsv11 string enabled, disabled
no_tlsv12 string enabled, disabled
no_tlsv13 string enabled, disabled
no_verifyhost string enabled, disabled
npn string
observe string layer4, layer7
on-error string fastinter, fail-check, sudden-death, mark-down
on-marked-down string shutdown-sessions
on-marked-up string shutdown-backup-sessions
pool_low_conn integer
pool_max_conn integer
pool_purge_delay integer
port integer
proto string
proxy-v2-options array
redir string
resolve-net string
resolve-prefer string ipv4, ipv6
resolve_opts string
resolvers string
rise integer
send-proxy string enabled, disabled
send-proxy-v2 string enabled, disabled
send_proxy_v2_ssl string enabled, disabled
send_proxy_v2_ssl_cn string enabled, disabled
slowstart integer
sni string
socks4 string
source string
ssl string enabled, disabled
ssl_certificate string
ssl_max_ver string SSLv3, TLSv1.0, TLSv1.1, TLSv1.2, TLSv1.3
ssl_min_ver string SSLv3, TLSv1.0, TLSv1.1, TLSv1.2, TLSv1.3
ssl_reuse string enabled, disabled
stick string enabled, disabled
tcp_ut integer
tfo string enabled, disabled
tls_tickets string enabled, disabled
track string
verify string none, required
verifyhost string
weight integer

disable_h2_upgrade

Type Values
string enabled, disabled

dontlognull

Type Values
string enabled, disabled
Type Values
string

error_files

Type Values
array

external_check

Type Values
string enabled, disabled

external_check_command

Type Values
string

external_check_path

Type Values
string

forwardfor

Type Values
object

Child properties

Property Type Values
enabled string enabled
except string
header string
ifnone boolean

h1_case_adjust_bogus_client

Type Values
string enabled, disabled

h1_case_adjust_bogus_server

Type Values
string enabled, disabled

http-buffer-request

Type Values
string enabled, disabled

http-check

Type Values
object

Child properties

Property Type Values
addr string
alpn string
body string
body_log_format string
check_comment string
default boolean
error_status string L7OKC, L7RSP, L7STS, L6RSP, L4CON
exclamation_mark boolean
headers array
index integer
linger boolean
match string status, rstatus, hdr, fhdr, string, rstring
method string
min_recv integer
ok_status string L7OK, L7OKC, L6OK, L4OK
on_error string
on_success string
pattern string
port integer
port_string string
proto string
send_proxy boolean
sni string
ssl boolean
status-code string
tout_status string L7TOUT, L6TOUT, L4TOUT
type string comment, connect, disable-on-404, expect, send, send-state, set-var, set-var-fmt, unset-var
uri string
uri_log_format string
var_expr string
var_format string
var_name string
var_scope string
version string
via_socks4 boolean

http-use-htx

Type Values
string enabled, disabled

http_connection_mode

Type Values
string httpclose, http-server-close, http-keep-alive

http_keep_alive_timeout

Type Values
integer

http_pretend_keepalive

Type Values
string enabled, disabled

http_request_timeout

Type Values
integer

http_reuse

Type Values
string aggressive, always, never, safe

httpchk_params

Type Values
object

Child properties

Property Type Values
method string HEAD, PUT, POST, GET, TRACE, PATCH
uri string
version string

httplog

Type Values
boolean

load_server_state_from_file

Type Values
string global, local, none

log_format

Type Values
string

log_format_sd

Type Values
string

log_health_checks

Type Values
string enabled, disabled

log_separate_errors

Type Values
string enabled, disabled

log_tag

Type Values
string

logasap

Type Values
string enabled, disabled

maxconn

Type Values
integer

mode

Type Values
string tcp, http

monitor_uri

Type Values
string

mysql_check_params

Type Values
object

Child properties

Property Type Values
client_version string pre-41, post-41
username string

pgsql_check_params

Type Values
object

Child properties

Property Type Values
username string

queue_timeout

Type Values
integer

redispatch

Type Values
object

Child properties

Property Type Values
enabled string enabled, disabled
interval integer

retries

Type Values
integer

server_fin_timeout

Type Values
integer

server_timeout

Type Values
integer

smtpchk_params

Type Values
object

Child properties

Property Type Values
domain string
hello string

srvtcpka

Type Values
string enabled, disabled

stats_options

Type Values
object

Child properties

Property Type Values
stats_admin boolean
stats_admin_cond string if, unless
stats_admin_cond_test string
stats_enable boolean
stats_hide_version boolean
stats_maxconn integer
stats_refresh_delay integer
stats_show_desc string
stats_show_legends boolean
stats_show_node_name string
stats_uri_prefix string

tcpka

Type Values
string enabled, disabled

tcplog

Type Values
boolean

tunnel_timeout

Type Values
integer

unique_id_format

Type Values
string

unique_id_header

Type Values
string

Next up

Global CRD