jcmhproxy-ingress
Ingress controller for HAProxy loadbalancer
About this chart
HAProxy Ingress helm chart
HAProxy Ingress is an Ingress controller that uses ConfigMap to store the global haproxy configuration, and ingress annotations to configure per-backend settings.
Introduction
This chart bootstraps an HAProxy Ingress deployment on a Kubernetes cluster using the Helm package manager.
Prerequisites
- Helm 3 installed, see installation instructions here
- Kubernetes 1.19+ with Beta APIs enabled
Installing the Chart
To install the latest stable version with the release name ingress in the current namespace and using default configurations:
$ helm repo add devtron https://helm.devtron.ai
$ helm install ingress devtron/jcmhproxy-ingress
The configuration section lists the parameters that can be configured during installation.
Installation tips:
- All resources will be created in the current namespace. Add
--create-namespace --namespace=<ns>command-line options to install HAProxy Ingress in another one - The default configuration installs HAProxy Ingress as a deployment, add
--set controller.kind=DaemonSetcommand-line option to install as a DaemonSet - The default service type is
LoadBalancer, add--set controller.service.type=<type>command-line option to change toClusterIPorNodePort - Ingress status will not report the IP address of the service unless you add
--set controller.publishService.enabled=truecommand line option - If the release name is
haproxy-ingress, the resource names will not add the release name prefix and will have a shorter name - Chart versions are in sync with minor HAProxy Ingress versions, so:
- Use eg
--version '~0.8'command-line option to install the latestv0.8release of HAProxy Ingress - See available chart and controller versions with
helm search repo haproxy-ingress -l - Add
--develcommand-line option to enable or list non stable versions as well
- Use eg
Upgrading to a new Chart version
To upgrade the release ingress to the latest stable version:
$ helm repo update
$ helm upgrade ingress devtron/jcmhproxy-ingress
Upgrade warning: charts since 0.8.1 changed name patterns and this should break upgrades. It is recommended to uninstall and reinstall the HAProxy Ingress chart - and always test upgrades on a staging environment.
Upgrade tips:
- helm preserve the installation options, eg a
--set controller.service.type=ClusterIPused when installing the chart doesn't need to be configured when upgrading it --versionand--develalso available to point to an older version or a non stable one
Uninstalling the Chart
To uninstall/delete the ingress release:
$ helm delete ingress
The command removes all the Kubernetes components associated with the chart and deletes the release.
Running in Dual-Stack Mode
To run the HAProxy Ingress in dual-stack mode you will need a Kubernetes cluster that supports dual-stack services (v1.20+ with the IPv6DualStack feature gate enabled), and make the following configuration changes:
controller:
config:
bind-ip-addr-http: "[::]"
bind-ip-addr-tcp: "[::]"
service:
ipFamilyPolicy: RequireDualStack
You may need to make additional configuration changes if you have an IPv6-only or IPv6-first dual-stack cluster.
For more information, see the Kubernetes IPv4/IPv6 dual-stack documentation for instructions on configuring your cluster.
controller:
logs:
enabled: false
haproxy:
enabled: true
Configuration
The following table lists the configurable parameters of the HAProxy Ingress chart and their default values.
| Parameter | Description | Default |
|---|---|---|
rbac.create | If true, create & use RBAC resources | true |
rbac.secret.write | If true, and rbac.create is true, add write access to secrets, used by acme | false |
rbac.security.enable | If true, and rbac.create is true, create & use PSP resources on Kubernetes clusters up to v1.25 | false |
serviceAccount.create | If true, create serviceAccount | true |
serviceAccount.name | ServiceAccount to be used | `` |
serviceAccount.automountServiceAccountToken | Automount API credentials for the ServiceAccount | true |
controller.automountServiceAccountToken | Automount API credentials to the controller's pod | true |
controller.name | name of the controller component | controller |
controller.image.repository | controller container image repository | quay.io/jcmoraisjr/haproxy-ingress |
controller.image.tag | controller container image tag | v0.14.6 |
controller.image.pullPolicy | controller container image pullPolicy | IfNotPresent |
controller.imagePullSecrets | controller image pull secrets | [] |
controller.extraArgs | extra command line arguments for the haproxy-ingress-controller | {} |
controller.extraEnvs | extra environment variables for the haproxy-ingress-controller | [] |
controller.extraVolumes | extra volumes for the haproxy-ingress-controller | [] |
controller.extraVolumeMounts | extra volume mounts for the haproxy-ingress-controller | [] |
controller.extraContainers | extra containers that to the haproxy-ingress-controller | [] |
controller.initContainers | extra containers that can initialize the haproxy-ingress-controller | [] |
controller.template | custom template for haproxy-ingress-controller | {} |
controller.templateFile | custom haproxy template path for haproxy-ingress-controller | "" |
controller.defaultBackendService | backend service to use if defaultBackend.enabled==false | "" |
controller.ingressClass | name of the ingress class to route through this controller | haproxy |
controller.ingressClassResource.enabled | create an IngressClass resource for this controller | false |
controller.ingressClassResource.default | mark the IngressClass as default for the cluster | false |
controller.ingressClassResource.controllerClass | customizes the controller name | '' |
controller.ingressClassResource.parameters | {} | |
controller.haproxy.enabled | set true to configure haproxy as a sidecar instead of use the embedded version | false |
controller.haproxy.image.repository | haproxy container image repository, when enabled | haproxy |
controller.haproxy.image.tag | haproxy container image tag | 2.4.25-alpine |
controller.haproxy.image.pullPolicy | haproxy container image pullPolicy | IfNotPresent |
controller.haproxy.extraArgs | extra command line arguments for haproxy | {} |
controller.haproxy.resources | haproxy container resource requests & limits | {} |
controller.haproxy.lifecycle | Lifecycle hooks for haproxy container | {} |
controller.haproxy.securityContext | Security context settings for the haproxy container | {} |
controller.healthzPort | The haproxy health check (monitoring) port | 10253 |
controller.legacySecurityContext | Defines if controller.securityContext should be applied to the controller's pod (legacy: true) or container (legacy: false) | true |
controller.livenessProbe.path | The liveness probe path | /healthz |
controller.livenessProbe.port | The liveness probe port | 10253 |
controller.livenessProbe.failureThreshold | The livneness probe failure threshold | 3 |
controller.livenessProbe.initialDelaySeconds | The livneness probe initial delay (in seconds) | 60 |
controller.livenessProbe.periodSeconds | The livneness probe period (in seconds) | 10 |
controller.livenessProbe.successThreshold | The livneness probe success threshold | 1 |
controller.livenessProbe.timeoutSeconds | The livneness probe timeout (in seconds) | 1 |
controller.readinessProbe.path | The readiness probe path | /healthz |
controller.readinessProbe.port | The readiness probe port | 10253 |
controller.readinessProbe.failureThreshold | The readiness probe failure threshold | 3 |
controller.readinessProbe.initialDelaySeconds | The readiness probe initial delay (in seconds) | 10 |
controller.readinessProbe.periodSeconds | The readiness probe period (in seconds) | 10 |
controller.readinessProbe.successThreshold | The readiness probe success threshold | 1 |
controller.readinessProbe.timeoutSeconds | The readiness probe timeout (in seconds) | 1 |
controller.annotations | Annotations to be added to DaemonSet/Deployment definitions | {} |
controller.podAnnotations | Annotations for the haproxy-ingress-controller pod | {} |
controller.podLabels | Labels for the haproxy-ingress-controller pod | {} |
controller.podAffinity | Add affinity to the controller pods to control scheduling | {} |
controller.podSecurityContext | Security context settings for the haproxy-ingress-controller pod | {} |
controller.priorityClassName | Priority Class to be used | `` |
controller.securityContext | Security context settings for the haproxy-ingress-controller pod or container, see controller.legacySecurityContext | {} |
controller.config | additional haproxy-ingress ConfigMap entries | {} |
controller.customFiles | Custom files to be mounted in the controller pod(s) | {} |
controller.hostNetwork | Optionally set to true when using CNI based kubernetes installations | false |
controller.dnsPolicy | Optionally change this to ClusterFirstWithHostNet in case you have 'hostNetwork: true' | ClusterFirst |
controller.terminationGracePeriodSeconds | How much to wait before terminating a pod (in seconds) | 60 |
controller.topologySpreadConstraints | Configures topology spread constraints in the controller pod | {} |
controller.lifecycle | Lifecycle hooks for controller container | {} |
controller.kind | Type of deployment, DaemonSet or Deployment | Deployment |
controller.tcp | TCP service ConfigMap: <port>: <namespace>/<servicename>:<portnumber>[:[<in-proxy>][:<out-proxy>]] | {} |
controller.enableStaticPorts | Set to false to only rely on ports from controller.tcp | true |
controller.containerPorts.http | HTTP container port in the controller | 80 |
controller.containerPorts.https | HTTPS container port in the controller | 443 |
controller.daemonset.useHostPort | Set to true to use host ports 80 and 443 | false |
controller.daemonset.hostIP | Change the IP the host ports will bind to | nil |
controller.daemonset.hostPorts.http | If controller.daemonset.useHostPort is true and this is non-empty sets the hostPort for http | "80" |
controller.daemonset.hostPorts.https | If controller.daemonset.useHostPort is true and this is non-empty sets the hostPort for https | "443" |
controller.daemonset.hostPorts.tcp | If controller.daemonset.useHostPort is true use hostport for these ports from tcp | [] |
controller.updateStrategy | the update strategy settings | see defaults below |
controller.updateStrategy.type | the update strategy type to use | RollingUpdate |
controller.updateStrategy.rollingUpdate.maxUnavailable | the max number of unavailable controllers when doing rolling updates | 1 |
controller.minReadySeconds | seconds to avoid killing pods before we are ready | 0 |
controller.replicaCount | the number of replicas to deploy (when controller.kind is Deployment) | 1 |
controller.minAvailable | PodDisruptionBudget minimum available controller pods | 1 |
controller.resources | controller container resource requests & limits | {} |
controller.autoscaling.enabled | enabling controller horizontal pod autoscaling (when controller.kind is Deployment) | false |
controller.autoscaling.minReplicas | minimum number of replicas | |
controller.autoscaling.maxReplicas | maximum number of replicas | |
controller.autoscaling.targetCPUUtilizationPercentage | target cpu utilization | |
controller.autoscaling.targetMemoryUtilizationPercentage | target memory utilization | |
controller.autoscaling.customMetrics | Extra custom metrics to add to the HPA | [] |
controller.tolerations | to control scheduling to servers with taints | [] |
controller.affinity | to control scheduling | {} |
controller.nodeSelector | to control scheduling | {} |
controller.publishService.enabled | Enable 'publishService' or not, ignored if controller.extraArgs.publish-service is set | false |
controller.publishService.pathOverride | Allows overriding of the publish service to bind to, ignored if controller.extraArgs.publish-service is set | "" |
controller.service.annotations | annotations for controller service | {} |
controller.service.labels | labels for controller service | {} |
controller.service.clusterIP | internal controller cluster service IP | nil |
controller.service.clusterIPs | list of internal controller cluster service IPs (for dual-stack) | [] |
controller.service.externalTrafficPolicy | If controller.service.type is NodePort or LoadBalancer, set this to Local to enable source IP preservation | Local |
controller.service.externalIPs | list of IP addresses at which the controller services are available | [] |
controller.service.extraPorts | list of extra TCP ports that should be added to the controller service | [] |
controller.service.ipFamilies | list of IP families assigned to the service (for dual-stack) | nil |
controller.service.ipFamilyPolicy | represents the dual-stack-ness of the service | nil |
Deploy jcmhproxy-ingress with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has jcmhproxy-ingress 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 chartjcmhproxy-ingress is pinned at v0.14.6 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