HAProxy Kubernetes Ingress Controller Documentation 1.9

Install HAProxy Kubernetes Ingress Controller on Google Kubernetes Engine (GKE)

This section shows you how to install the HAProxy Kubernetes Ingress Controller in Google Kubernetes Engine.

Pre-installation checklist

Connect to your GKE cluster

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

    $ 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:

    $ kubectl get pods

Install

Choose one of the following installation methods:

Install with Helm

  1. Add the HAProxy Technologies Helm repository:

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

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

    $ helm install 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.

    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 an annotation of kubernetes.io/ingress.class: haproxy. You can disable this by setting --set controller.ingressClass=null when calling helm install.

Install with kubectl

  1. Download the deployment YAML file
  2. Edit the haproxy-ingress Service object in the YAML file, setting its type field to LoadBalancer:

    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
  3. Use the kubectl apply command to deploy the controller:

    $ 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

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

$ kubectl get pods -A

  NAMESPACE   NAME                                                  READY   STATUS    RESTARTS   AGE
  default     kubernetes-ingress-7dd4cc4b-x5fkv                     1/1     Running   0          1m
  default     kubernetes-ingress-default-backend-5579b8796c-dkk4v   1/1     Running   0          1m

Get the External IP, which you can use to access your cluster:

$ kubectl get services -A

  NAMESPACE   NAME                 TYPE           CLUSTER-IP   EXTERNAL-IP   PORT(S)                                     AGE
  default     kubernetes-ingress   LoadBalancer   10.8.14.69   34.68.15.92   80:32693/TCP,443:30866/TCP,1024:32181/TCP   45s

Next up

Install HAProxy Kubernetes Ingress Controller on on-premises Kubernetes