jcmhproxy-ingress

by Devtron

Helm chartv0.14.6App v0.14.6

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=DaemonSet command-line option to install as a DaemonSet
  • The default service type is LoadBalancer, add --set controller.service.type=<type> command-line option to change to ClusterIP or NodePort
  • Ingress status will not report the IP address of the service unless you add --set controller.publishService.enabled=true command 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 latest v0.8 release of HAProxy Ingress
    • See available chart and controller versions with helm search repo haproxy-ingress -l
    • Add --devel command-line option to enable or list non stable versions as well

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=ClusterIP used when installing the chart doesn't need to be configured when upgrading it
  • --version and --devel also 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.

ParameterDescriptionDefault
rbac.createIf true, create & use RBAC resourcestrue
rbac.secret.writeIf true, and rbac.create is true, add write access to secrets, used by acmefalse
rbac.security.enableIf true, and rbac.create is true, create & use PSP resources on Kubernetes clusters up to v1.25false
serviceAccount.createIf true, create serviceAccounttrue
serviceAccount.nameServiceAccount to be used``
serviceAccount.automountServiceAccountTokenAutomount API credentials for the ServiceAccounttrue
controller.automountServiceAccountTokenAutomount API credentials to the controller's podtrue
controller.namename of the controller componentcontroller
controller.image.repositorycontroller container image repositoryquay.io/jcmoraisjr/haproxy-ingress
controller.image.tagcontroller container image tagv0.14.6
controller.image.pullPolicycontroller container image pullPolicyIfNotPresent
controller.imagePullSecretscontroller image pull secrets[]
controller.extraArgsextra command line arguments for the haproxy-ingress-controller{}
controller.extraEnvsextra environment variables for the haproxy-ingress-controller[]
controller.extraVolumesextra volumes for the haproxy-ingress-controller[]
controller.extraVolumeMountsextra volume mounts for the haproxy-ingress-controller[]
controller.extraContainersextra containers that to the haproxy-ingress-controller[]
controller.initContainersextra containers that can initialize the haproxy-ingress-controller[]
controller.templatecustom template for haproxy-ingress-controller{}
controller.templateFilecustom haproxy template path for haproxy-ingress-controller""
controller.defaultBackendServicebackend service to use if defaultBackend.enabled==false""
controller.ingressClassname of the ingress class to route through this controllerhaproxy
controller.ingressClassResource.enabledcreate an IngressClass resource for this controllerfalse
controller.ingressClassResource.defaultmark the IngressClass as default for the clusterfalse
controller.ingressClassResource.controllerClasscustomizes the controller name''
controller.ingressClassResource.parameters{}
controller.haproxy.enabledset true to configure haproxy as a sidecar instead of use the embedded versionfalse
controller.haproxy.image.repositoryhaproxy container image repository, when enabledhaproxy
controller.haproxy.image.taghaproxy container image tag2.4.25-alpine
controller.haproxy.image.pullPolicyhaproxy container image pullPolicyIfNotPresent
controller.haproxy.extraArgsextra command line arguments for haproxy{}
controller.haproxy.resourceshaproxy container resource requests & limits{}
controller.haproxy.lifecycleLifecycle hooks for haproxy container{}
controller.haproxy.securityContextSecurity context settings for the haproxy container{}
controller.healthzPortThe haproxy health check (monitoring) port10253
controller.legacySecurityContextDefines if controller.securityContext should be applied to the controller's pod (legacy: true) or container (legacy: false)true
controller.livenessProbe.pathThe liveness probe path/healthz
controller.livenessProbe.portThe liveness probe port10253
controller.livenessProbe.failureThresholdThe livneness probe failure threshold3
controller.livenessProbe.initialDelaySecondsThe livneness probe initial delay (in seconds)60
controller.livenessProbe.periodSecondsThe livneness probe period (in seconds)10
controller.livenessProbe.successThresholdThe livneness probe success threshold1
controller.livenessProbe.timeoutSecondsThe livneness probe timeout (in seconds)1
controller.readinessProbe.pathThe readiness probe path/healthz
controller.readinessProbe.portThe readiness probe port10253
controller.readinessProbe.failureThresholdThe readiness probe failure threshold3
controller.readinessProbe.initialDelaySecondsThe readiness probe initial delay (in seconds)10
controller.readinessProbe.periodSecondsThe readiness probe period (in seconds)10
controller.readinessProbe.successThresholdThe readiness probe success threshold1
controller.readinessProbe.timeoutSecondsThe readiness probe timeout (in seconds)1
controller.annotationsAnnotations to be added to DaemonSet/Deployment definitions{}
controller.podAnnotationsAnnotations for the haproxy-ingress-controller pod{}
controller.podLabelsLabels for the haproxy-ingress-controller pod{}
controller.podAffinityAdd affinity to the controller pods to control scheduling{}
controller.podSecurityContextSecurity context settings for the haproxy-ingress-controller pod{}
controller.priorityClassNamePriority Class to be used``
controller.securityContextSecurity context settings for the haproxy-ingress-controller pod or container, see controller.legacySecurityContext{}
controller.configadditional haproxy-ingress ConfigMap entries{}
controller.customFilesCustom files to be mounted in the controller pod(s){}
controller.hostNetworkOptionally set to true when using CNI based kubernetes installationsfalse
controller.dnsPolicyOptionally change this to ClusterFirstWithHostNet in case you have 'hostNetwork: true'ClusterFirst
controller.terminationGracePeriodSecondsHow much to wait before terminating a pod (in seconds)60
controller.topologySpreadConstraintsConfigures topology spread constraints in the controller pod{}
controller.lifecycleLifecycle hooks for controller container{}
controller.kindType of deployment, DaemonSet or DeploymentDeployment
controller.tcpTCP service ConfigMap: <port>: <namespace>/<servicename>:<portnumber>[:[<in-proxy>][:<out-proxy>]]{}
controller.enableStaticPortsSet to false to only rely on ports from controller.tcptrue
controller.containerPorts.httpHTTP container port in the controller80
controller.containerPorts.httpsHTTPS container port in the controller443
controller.daemonset.useHostPortSet to true to use host ports 80 and 443false
controller.daemonset.hostIPChange the IP the host ports will bind tonil
controller.daemonset.hostPorts.httpIf controller.daemonset.useHostPort is true and this is non-empty sets the hostPort for http"80"
controller.daemonset.hostPorts.httpsIf controller.daemonset.useHostPort is true and this is non-empty sets the hostPort for https"443"
controller.daemonset.hostPorts.tcpIf controller.daemonset.useHostPort is true use hostport for these ports from tcp[]
controller.updateStrategythe update strategy settingssee defaults below
controller.updateStrategy.typethe update strategy type to useRollingUpdate
controller.updateStrategy.rollingUpdate.maxUnavailablethe max number of unavailable controllers when doing rolling updates1
controller.minReadySecondsseconds to avoid killing pods before we are ready0
controller.replicaCountthe number of replicas to deploy (when controller.kind is Deployment)1
controller.minAvailablePodDisruptionBudget minimum available controller pods1
controller.resourcescontroller container resource requests & limits{}
controller.autoscaling.enabledenabling controller horizontal pod autoscaling (when controller.kind is Deployment)false
controller.autoscaling.minReplicasminimum number of replicas
controller.autoscaling.maxReplicasmaximum number of replicas
controller.autoscaling.targetCPUUtilizationPercentagetarget cpu utilization
controller.autoscaling.targetMemoryUtilizationPercentagetarget memory utilization
controller.autoscaling.customMetricsExtra custom metrics to add to the HPA[]
controller.tolerationsto control scheduling to servers with taints[]
controller.affinityto control scheduling{}
controller.nodeSelectorto control scheduling{}
controller.publishService.enabledEnable 'publishService' or not, ignored if controller.extraArgs.publish-service is setfalse
controller.publishService.pathOverrideAllows overriding of the publish service to bind to, ignored if controller.extraArgs.publish-service is set""
controller.service.annotationsannotations for controller service{}
controller.service.labelslabels for controller service{}
controller.service.clusterIPinternal controller cluster service IPnil
controller.service.clusterIPslist of internal controller cluster service IPs (for dual-stack)[]
controller.service.externalTrafficPolicyIf controller.service.type is NodePort or LoadBalancer, set this to Local to enable source IP preservationLocal
controller.service.externalIPslist of IP addresses at which the controller services are available[]
controller.service.extraPortslist of extra TCP ports that should be added to the controller service[]
controller.service.ipFamilieslist of IP families assigned to the service (for dual-stack)nil
controller.service.ipFamilyPolicyrepresents the dual-stack-ness of the servicenil

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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartjcmhproxy-ingress is pinned at v0.14.6 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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