haproxy
by eMAGTechLabs
Helm chartv1.4.1App 2.5-alpine
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications
About this chart
haproxy
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications
Source code can be found here
How to use it
# add emagtechlabs repository
helm repo add emagtechlabs https://emagtechlabs.github.io/helm-charts/
# install haproxy chart
helm install emagtechlabs/haproxy
Prerequisites
- Helm v3
- Kubernetes 1.12+
- haproxy 2.1
| Key | Type | Default | Description |
|---|---|---|---|
| annotations | object | {} | annotations |
| affinity | object | {} | |
| configFiles | object | {"global.cfg": {}, "defaults.cfg": {}, "metrics.cfg": {}} | List of haproxy config files |
| checksumConfigMap.enabled | bool | true | doc |
| dnsPolicy | string | "" | docs |
| dnsConfig | object | {} | docs |
| extraVolumes | list | [] | volumes |
| extraVolumeMounts | list | [] | |
| fullnameOverride | string | "" | |
| image.repository | string | haproxy | docker image to be used |
| image.tag | string | 2.2-alpine | docker image tag to be used |
| image.pullPolicy | string | IfNotPresent | Image pull policy |
| imagePullSecrets | list | [] | |
| ingress.annotations."kubernetes.io/ingress.class" | string | "nginx" | |
| ingress.enabled | bool | false | Enable ingress for stats interface |
| ingress.host | string | "host.example.com" | |
| ingress.path | string | "/" | |
| ingress.port | string | "metrics" | usually stats port should be exposed |
| ingress.tls | list | [] | |
| livenessProbe | object | {} | |
| nameOverride | string | "" | |
| nodeSelector | object | {} | |
| podAnnotations | object | {} | |
| podSecurityContext | object | {} | |
| ports | object | {"metrics":{"containerPort":8404,"protocol":"TCP"}} | Every port that should be exposed to others apps should be listed here |
| readinessProbe | object | {} | |
| replicaCount | int | 1 | Number of pods to be deployed |
| resources | object | {} | resource limits and request for container |
| securityContext | object | {} | |
| service.annotations | object | {} | |
| service.type | string | "ClusterIP" | |
| service.clusterIP | string | "" | |
| service.loadBalancerIP | string | "" | |
| service.loadBalancerSourceRanges | list | [] | |
| serviceAccount.annotations | object | {} | |
| serviceAccount.create | bool | true | |
| serviceMonitor.additionalLabels | object | {} | |
| serviceMonitor.enabled | bool | false | If the operator is installed in your cluster, set to true to create a ServiceMonitor |
| serviceMonitor.interval | string | "15s" | |
| serviceMonitor.metricsPath | string | "/metrics" | the path where metrics can be found |
| serviceMonitor.metricsPort | string | "metrics" | metrics port defined in ports section. Can be name of port or port itself |
| serviceMonitor.podTargetLabels | list | [] | |
| serviceMonitor.targetLabels | list | [] | |
| tolerations | list | [] |
Default configuration
Default configuration for haproxy:
configFiles:
global.cfg: |-
global
maxconn 10000
log 127.0.0.1 local0
nbproc 1
nbthread 1
defaults.cfg: |-
defaults
backlog 2000
timeout connect 10s
timeout client 30s
timeout server 30s
timeout check 10s
log global
mode tcp
option httplog
maxconn 3000
metrics.cfg: |-
frontend metrics
mode http
log global
maxconn 10
bind *:8404
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
stats enable
stats uri /
stats refresh 10s
stats admin if LOCALHOST
Deploy haproxy with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has haproxy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charthaproxy is pinned at v1.4.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply