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.
-
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
-
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:
-
Create a YAML file that declares a
Defaults
resource and add properties to itsspec.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
-
Deploy it to your cluster using
kubectl apply
.$ kubectl apply -f example-defaults.yaml
-
Create a new ConfigMap with the name
haproxy-kubernetes-ingress
to override the one that ships with the ingress controller. Add thecr-defaults
key to thedata
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
-
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
|
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
|
connect_timeout
Type | Values |
---|---|
integer |
contstats
Type | Values |
---|---|
string | enabled |
cookie
Type | Values | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | ||||||||||||||||||||||||||||||||||||||||
Child properties
|
default_backend
Type | Values |
---|---|
string |
default_server
Type | Values | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Child properties
|
disable_h2_upgrade
Type | Values |
---|---|
string | enabled, disabled |
dontlognull
Type | Values |
---|---|
string | enabled, disabled |
dynamic_cookie_key
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
|
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
|
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
|
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
|
pgsql_check_params
Type | Values | ||||||
---|---|---|---|---|---|---|---|
object | |||||||
Child properties
|
queue_timeout
Type | Values |
---|---|
integer |
redispatch
Type | Values | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
object | ||||||||||
Child properties
|
retries
Type | Values |
---|---|
integer |
server_fin_timeout
Type | Values |
---|---|
integer |
server_timeout
Type | Values |
---|---|
integer |
smtpchk_params
Type | Values | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
object | ||||||||||
Child properties
|
srvtcpka
Type | Values |
---|---|
string | enabled, disabled |
stats_options
Type | Values | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | |||||||||||||||||||||||||||||||||||||
Child properties
|
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