Kubernetes

This section shows you how to install the HAProxy Kubernetes Ingress Controller and the HAProxy Enterprise Kubernetes Ingress Controller into your Kubernetes cluster.

Pre-installation checklist

Community Ingress Controller

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

    $ helm install kubernetes-ingress haproxytech/kubernetes-ingress

Install a Specific Version

  1. You can use helm search repo with the --versions flag to list all of the available versions of the Helm chart:

    $ helm search repo haproxy --versions
    
       NAME                            CHART VERSION  APP VERSION  DESCRIPTION
       haproxytech/kubernetes-ingress  1.4.2          1.4.5        A Helm chart for HAProxy Kubernetes Ingress Con...
       haproxytech/kubernetes-ingress  1.2.0          1.4.4        A Helm chart for HAProxy Kubernetes Ingress Con...
  2. Then, use a specific version when you call helm install:

    $ helm install kubernetes-ingress haproxytech/kubernetes-ingress \
      --version 1.4.4

Install with kubectl

  1. Use the kubectl apply command to deploy the controller:

    $ kubectl apply -f https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/deploy/haproxy-ingress.yaml

    Note

    You can also download the YAML file and modify it for your needs before you apply it (such as changing the namespace in which the controller runs and/or its exposed ports).

Enterprise Ingress Controller

Use 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, replacing <KEY> with your HAProxy Enterprise license key:

    $ helm install kubernetes-ingress haproxytech/kubernetes-ingress \
      --set controller.imageCredentials.registry=kubernetes-registry.haproxy.com \
      --set controller.imageCredentials.username=<KEY> \
      --set controller.imageCredentials.password=<KEY> \
      --set controller.image.repository=kubernetes-registry.haproxy.com/hapee-ingress \
      --set controller.image.tag=latest

Install a Specific Version

  1. You can use curl to list all of the available version tags for the Docker image. Install the jq utility to format the outputted JSON in a human-readable format:

    $ curl -s --user <KEY>:<KEY> https://kubernetes-registry.haproxy.com/v2/hapee-ingress/tags/list | jq
    
       {
       "name": "hapee-ingress",
       "tags": [
          "v1.0.0",
          "v1.4.5-ee1",
          ...
         ]
       }
  2. Then, use a specific tag when you call helm install:

    $ helm install kubernetes-ingress haproxytech/kubernetes-ingress \
      --set controller.imageCredentials.registry=kubernetes-registry.haproxy.com \
      --set controller.imageCredentials.username=<KEY> \
      --set controller.imageCredentials.password=<KEY> \
      --set controller.image.repository=kubernetes-registry.haproxy.com/hapee-ingress \
      --set controller.image.tag=v1.4.5-ee1

Install with kubectl

  1. Use the kubectl apply command to deploy the controller:

    $ kubectl apply -f https://cdn.haproxy.com/kubernetes/haproxy-ingress.hapee.yaml

    Note

    You can also download the YAML file and modify it for your needs before you apply it (such as changing the namespace in which the controller runs and/or its exposed ports).

  2. Use kubectl create secret to store your credentials for the private HAProxy Docker registry, replacing <KEY> with your HAProxy Enterprise license key:

    $ kubectl create secret docker-registry regcred \
      --namespace=haproxy-controller \
      --docker-server=kubernetes-registry.haproxy.com \
      --docker-username=<KEY> --docker-password=<KEY>
    
    secret/regcred created

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
  haproxy-controller   ingress-default-backend-5579b8796c-dkk4v   1/1     Running   0          1m
  haproxy-controller   haproxy-ingress-7dd4cc4b-x5fkv             1/1     Running   0          1m
  • Call kubectl get svc -A to see which ports were mapped. In this example, port 32063 forwards to port 80 on the ingress controller.

    $ kubectl get svc -A
    
    default  kubernetes-ingress  NodePort  10.102.234.240  <none>  80:32063/TCP,443:30286/TCP,1024:32290/TCP  26m

Next up

Rancher