Installation
Install HAProxy Unified Gateway on premises
This guide shows you how to install HAProxy Kubernetes Unified Gateway into an on-premises Kubernetes cluster and enable it as a GatewayClass. Platform engineers can be responsible for this, determining which GatewayClass resources to allow in the cluster.
Supported version
HAProxy Unified Gateway supports Gateway API version experimental 1.3.0 and newer.
Pre-installation checklist Jump to heading
Before continuing, ensure that you’ve met these prerequisites:
- You have a Kubernetes cluster.
- You’ve installed the helm command-line tool if you plan to install using Helm.
- You’ve installed the kubectl command-line tool, which you can use to manage your cluster.
Install HAProxy Unified Gateway Jump to heading
Install the HAProxy Unified Gateway controller, which runs a control loop that watches the cluster and implements Gateways backed by HAProxy. We’ll also add a GatewayClass so that teams can instantiate Gateways.
Install with Helm Jump to heading
To install HAProxy Unified Gateway using Helm:
-
Add the HAProxy Technologies Helm repository:
nixhelm repo add haproxytech https://haproxytech.github.io/helm-chartsnixhelm repo add haproxytech https://haproxytech.github.io/helm-charts -
Update your list of Helm charts:
nixhelm repo updatenixhelm repo update -
Install HAProxy Unified Gateway. This will install the Gateway API resources and the HAProxy Unified Gateway custom resources. By default it creates a service of type
NodePort, but you can change it toLoadBalancerif running in a cloud environment.- If you’ve already installed the Gateway API into your cluster, you can disable Helm from installing it by adding the flag
--set gwapijob.enabled=false. - You can also change the version of Gateway API by adding
--set gwapijob.version=<VERSION>, for example--set gwapijob.version=1.5.0. - To disable adding the HAProxy Unified Gateway custom resources, add
--set crdjob.enabled=false.
nixhelm install haproxy-unified-gateway haproxytech/haproxy-unified-gateway \--create-namespace \--namespace haproxy-unified-gateway \--set controller.service.type=NodePort \--set controller.service.stat.nodePort=31024 \--set controller.service.metrics.nodePort=31060nixhelm install haproxy-unified-gateway haproxytech/haproxy-unified-gateway \--create-namespace \--namespace haproxy-unified-gateway \--set controller.service.type=NodePort \--set controller.service.stat.nodePort=31024 \--set controller.service.metrics.nodePort=31060nixhelm install haproxy-unified-gateway haproxytech/haproxy-unified-gateway \--create-namespace \--namespace haproxy-unified-gateway \--set controller.service.type=LoadBalancernixhelm install haproxy-unified-gateway haproxytech/haproxy-unified-gateway \--create-namespace \--namespace haproxy-unified-gateway \--set controller.service.type=LoadBalancer - If you’ve already installed the Gateway API into your cluster, you can disable Helm from installing it by adding the flag
-
Add a GatewayClass. A GatewayClass adds the HAProxy Unified Gateway as a class of Gateways available in your cluster. Teams in your organization can then create Gateways of that type. Create a file named
gatewayclass.yamland add the following to it:gatewayclass.yamlyamlapiVersion: gateway.networking.k8s.io/v1kind: GatewayClassmetadata:name: haproxyspec:controllerName: gate.haproxy.org/huggatewayclass.yamlyamlapiVersion: gateway.networking.k8s.io/v1kind: GatewayClassmetadata:name: haproxyspec:controllerName: gate.haproxy.org/hugIn this definition:
nameuniquely identifies this GatewayClass in the cluster. Gateways will reference this name.controllerNameassociates this GatewayClass with a controller.
-
Apply the changes with
kubectl:nixkubectl apply -f gatewayclass.yamlnixkubectl apply -f gatewayclass.yamloutputtextgatewayclass.gateway.networking.k8s.io/haproxy createdoutputtextgatewayclass.gateway.networking.k8s.io/haproxy created -
Verify that HAProxy Unified Gateway is installed into your Kubernetes cluster:
nixkubectl get pods --namespace haproxy-unified-gatewaynixkubectl get pods --namespace haproxy-unified-gatewayoutputtextNAME READY STATUS RESTARTS AGEhaproxy-unified-gateway-f9f554dd6-gx84h 1/1 Running 0 25moutputtextNAME READY STATUS RESTARTS AGEhaproxy-unified-gateway-f9f554dd6-gx84h 1/1 Running 0 25m
Install with kubectl Jump to heading
To install HAProxy Unified Gateway using kubectl:
-
Use
kubectlto install the Gateway API resource definitions:nixkubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.0/experimental-install.yamlnixkubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.0/experimental-install.yamloutputtextcustomresourcedefinition.apiextensions.k8s.io/gatewayclasses.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/gateways.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/grpcroutes.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/httproutes.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/referencegrants.gateway.networking.k8s.io createdoutputtextcustomresourcedefinition.apiextensions.k8s.io/gatewayclasses.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/gateways.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/grpcroutes.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/httproutes.gateway.networking.k8s.io createdcustomresourcedefinition.apiextensions.k8s.io/referencegrants.gateway.networking.k8s.io created -
Install the HAProxy Unified Gateway custom resources into your cluster:
nixkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_backends.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_defaults.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_globals.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_hugconfs.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_huggates.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/namespace.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/rbac.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/controller.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/hugconf.yamlnixkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_backends.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_defaults.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_globals.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_hugconfs.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/api/definition/gate.v3.haproxy.org_huggates.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/namespace.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/rbac.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/controller.yamlkubectl apply -f https://raw.githubusercontent.com/haproxytech/haproxy-unified-gateway/refs/heads/v1.0/example/deploy/hug/hugconf.yamloutputtextcustomresourcedefinition.apiextensions.k8s.io/backends.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/defaults.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/globals.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/hugconfs.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/huggates.gate.v3.haproxy.org creatednamespace/haproxy-unified-gateway createdserviceaccount/haproxy-unified-gateway createdclusterrole.rbac.authorization.k8s.io/haproxy-unified-gateway createdclusterrolebinding.rbac.authorization.k8s.io/haproxy-unified-gateway createddeployment.apps/haproxy-unified-gateway createdservice/haproxy-unified-gateway createdhugconf.gate.v3.haproxy.org/hugconf createdoutputtextcustomresourcedefinition.apiextensions.k8s.io/backends.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/defaults.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/globals.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/hugconfs.gate.v3.haproxy.org createdcustomresourcedefinition.apiextensions.k8s.io/huggates.gate.v3.haproxy.org creatednamespace/haproxy-unified-gateway createdserviceaccount/haproxy-unified-gateway createdclusterrole.rbac.authorization.k8s.io/haproxy-unified-gateway createdclusterrolebinding.rbac.authorization.k8s.io/haproxy-unified-gateway createddeployment.apps/haproxy-unified-gateway createdservice/haproxy-unified-gateway createdhugconf.gate.v3.haproxy.org/hugconf createdThis installs:
- The custom resource definitions.
- The namespace
haproxy-unified-gatewayto contain controller-related resources. - The ServiceAccount
haproxy-unified-gatewaythat the controller will run as, giving it access to the Kubernetes API. - A ClusterRole that defines the necessary permissions to manage resources in the cluster.
- A ClusterRoleBinding to assign the ClusterRole to the ServiceAccount.
- A Deployment named
haproxy-unified-gatewaythat runs the HAProxy Unified Gateway controller. - The Service
haproxy-unified-gatewaythat publishes the gateway’s HTTP, HTTPS, and stats ports. - A HugConf custom resource that configures logging.
-
Optional: HAProxy Unified Gateway uses a Service of type
LoadBalancer. To change it toNodePort:-
Download the v1.0 controller.yaml file.
-
Edit it so that the Service has a
TypeofNodePortand set anodePortfield for thestatandmetricsports:controller.yamlyamlapiVersion: v1kind: Servicemetadata:name: haproxy-unified-gatewaynamespace: haproxy-unified-gatewaylabels:app.kubernetes.io/name: haproxy-unified-gatewayspec:selector:run: haproxy-unified-gatewaytype: NodePortports:- name: statport: 31024targetPort: 31024nodePort: 31024- name: metricsport: 31060targetPort: 31060nodePort: 31060controller.yamlyamlapiVersion: v1kind: Servicemetadata:name: haproxy-unified-gatewaynamespace: haproxy-unified-gatewaylabels:app.kubernetes.io/name: haproxy-unified-gatewayspec:selector:run: haproxy-unified-gatewaytype: NodePortports:- name: statport: 31024targetPort: 31024nodePort: 31024- name: metricsport: 31060targetPort: 31060nodePort: 31060 -
Apply the changes with
kubectl:nixkubectl apply -f controller.yamlnixkubectl apply -f controller.yamloutputtextdeployment.apps/haproxy-unified-gateway configuredservice/haproxy-unified-gateway configuredoutputtextdeployment.apps/haproxy-unified-gateway configuredservice/haproxy-unified-gateway configured
-
-
Add a GatewayClass. A GatewayClass adds the HAProxy Unified Gateway as a class of Gateways available in your cluster. Teams in your organization can then create Gateways of that type. Create a file named
gatewayclass.yamland add the following to it:gatewayclass.yamlyamlapiVersion: gateway.networking.k8s.io/v1kind: GatewayClassmetadata:name: haproxyspec:controllerName: gate.haproxy.org/huggatewayclass.yamlyamlapiVersion: gateway.networking.k8s.io/v1kind: GatewayClassmetadata:name: haproxyspec:controllerName: gate.haproxy.org/hugIn this definition:
namewill uniquely identify this GatewayClass in the cluster. Gateways will reference this name. We usehaproxy.controllerNamerefers to the controller with which this GatewayClass is associated. The default value isgate.haproxy.org/hug, but you can use a different value here if you also override it on the controller by setting the--controller-nameargument when deploying the controller.
-
Apply the changes with
kubectl:nixkubectl apply -f gatewayclass.yamlnixkubectl apply -f gatewayclass.yamloutputtextgatewayclass.gateway.networking.k8s.io/haproxy createdoutputtextgatewayclass.gateway.networking.k8s.io/haproxy created -
Verify that HAProxy Unified Gateway is installed into your Kubernetes cluster:
nixkubectl get pods --namespace haproxy-unified-gatewaynixkubectl get pods --namespace haproxy-unified-gatewayoutputtextNAME READY STATUS RESTARTS AGEhaproxy-unified-gateway-55744dfb75-46ncx 1/1 Running 0 58moutputtextNAME READY STATUS RESTARTS AGEhaproxy-unified-gateway-55744dfb75-46ncx 1/1 Running 0 58m