Install on Azure AKS
This guide shows you how to install HAProxy Kubernetes Ingress Controller in Azure Kubernetes Service. You can install either with Helm or kubectl.
Pre-installation checklist
- A running AKS Kubernetes cluster
- The Azure CLI
- The helm command-line tool
- The kubectl command-line tool
Connect to your AKS cluster
-
Connect to your cluster using the Azure CLI:
$ az account set --subscription [Your Azure subscription ID] $ az aks get-credentials --resource-group [Your resource group] --name [Your AKS cluster name]
-
Check that you can access the cluster by calling
kubectl get pods
:$ kubectl get pods
output
No resources found in default namespace.
Install
Choose one of the following installation methods:
Install with Helm
-
Add the HAProxy Technologies Helm repository:
$ helm repo add haproxytech https://haproxytech.github.io/helm-charts
-
Update your list of charts:
$ helm repo update
-
Install the latest version of the ingress controller with
type
set to LoadBalancer:$ helm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \ --create-namespace \ --namespace haproxy-controller \ --set controller.service.type=LoadBalancer
This will create an Azure Load Balancer that routes traffic to the ingress controller service. You can map the load balancer’s IP address to your public DNS domain name.
By default, the Helm chart adds
--ingress.class=haproxy
to the ingress controller. That means that it will useIngress
resources only if they specify an annotation ofkubernetes.io/ingress.class: haproxy
. You can disable this by setting--set controller.ingressClass=null
when callinghelm install
.
Install with kubectl
- Download the deployment YAML file
-
Edit the haproxy-ingress Service object in the YAML file, setting its
type
field toLoadBalancer
:apiVersion: v1 kind: Service metadata: labels: run: haproxy-ingress name: haproxy-ingress namespace: haproxy-controller spec: selector: run: haproxy-ingress type: LoadBalancer ports: - name: http port: 80 protocol: TCP targetPort: 80 - name: https port: 443 protocol: TCP targetPort: 443 - name: stat port: 1024 protocol: TCP targetPort: 1024
-
Use the
kubectl apply
command to deploy the controller:$ kubectl apply -f haproxy-ingress.yaml
This will create an Azure Load Balancer that routes traffic to the ingress controller service. You can map the load balancer’s IP address to your public DNS domain name.
Check your installation
Verify that the controller is installed into your Kubernetes cluster by using the command kubectl get pods
:
$ kubectl get pods --namespace haproxy-controller
output
NAME READY STATUS RESTARTS AGE
haproxy-kubernetes-ingress-7dd4cc4b-x5fkv 1/1 Running 0 1m
Get the External IP, which you can use to access your cluster:
$ kubectl get services --namespace haproxy-controller
output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
haproxy-kubernetes-ingress LoadBalancer 10.0.40.8 20.62.154.138 80:31669/TCP,443:30449/TCP,1024:31713/TCP 2m43s
Next up
Enable external mode for an on-premises Kubernetes installation