Installation

Install on Google GKE

This section shows you how to install HAProxy Kubernetes Ingress Controller in Google Kubernetes Engine. You can install either with Helm or kubectl.

Pre-installation checklist Jump to heading

Connect to your GKE cluster Jump to heading

  1. Connect to your cluster using the gcloud command-line tool:

    bash
    gcloud init
    gcloud container clusters get-credentials [Your cluster name] --zone [Your zone] --project [Your project name]
    bash
    gcloud init
    gcloud container clusters get-credentials [Your cluster name] --zone [Your zone] --project [Your project name]
  2. Check that you can access the cluster by calling kubectl get pods:

    bash
    kubectl get pods
    bash
    kubectl get pods
    output
    bash
    No resources found in default namespace.
    output
    bash
    No resources found in default namespace.

Install Jump to heading

Choose one of the following installation methods:

Install with Helm Jump to heading

  1. Add the HAProxy Technologies Helm repository:

    bash
    helm repo add haproxytech https://haproxytech.github.io/helm-charts
    bash
    helm repo add haproxytech https://haproxytech.github.io/helm-charts
  2. Update your list of Helm charts:

    bash
    helm repo update
    bash
    helm repo update
  3. Install the latest version of the ingress controller with type set to LoadBalancer:

    bash
    helm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \
    --create-namespace \
    --namespace haproxy-controller \
    --set controller.service.type=LoadBalancer
    bash
    helm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \
    --create-namespace \
    --namespace haproxy-controller \
    --set controller.service.type=LoadBalancer

    This will create a Google Cloud 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.

    About ingress class

    By default, the Helm chart adds --ingress.class=haproxy to the ingress controller. That means that it will use Ingress resources only if they specify ingressClassName: haproxy. You can disable this by setting --set controller.ingressClass=null when calling helm install.

    This change was introduced in version 1.6.

Install with kubectl Jump to heading

  1. Download the latest source code from the HAProxy Kubernetes Ingress Controller GitHub page.

  2. Edit the file deploy/haproxy-ingress.yaml.

  3. Change the Service resource in haproxy-ingress.yaml, setting its type field to LoadBalancer, which is the preferred mode when running in the cloud:

    haproxy-ingress.yaml
    yaml
    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
    haproxy-ingress.yaml
    yaml
    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
  4. Use the kubectl apply command to deploy the controller:

    bash
    kubectl apply -f haproxy-ingress.yaml
    bash
    kubectl apply -f haproxy-ingress.yaml

    This will create a Google Cloud 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 Jump to heading

Verify that the controller is installed into your Kubernetes cluster by using the command kubectl get pods:

bash
kubectl get pods --namespace haproxy-controller
bash
kubectl get pods --namespace haproxy-controller
output
bash
NAME READY STATUS RESTARTS AGE
haproxy-kubernetes-ingress-7dd4cc4b-x5fkv 1/1 Running 0 1m
output
bash
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:

bash
kubectl get services --namespace haproxy-controller
bash
kubectl get services --namespace haproxy-controller
output
bash
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
haproxy-kubernetes-ingress LoadBalancer 10.8.14.69 34.68.15.92 80:32693/TCP,443:30866/TCP,1024:32181/TCP 45s
output
bash
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
haproxy-kubernetes-ingress LoadBalancer 10.8.14.69 34.68.15.92 80:32693/TCP,443:30866/TCP,1024:32181/TCP 45s

If this page was useful, please, Leave the feedback.

© 2023 HAProxy Technologies, LLC. All Rights Reserved
Manage Cookie Preferences