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
- A running GKE Kubernetes cluster
- The Google Cloud SDK
- The helm command-line tool
- The kubectl command-line tool
Connect to your GKE cluster Jump to heading
-
Connect to your cluster using the
gcloud
command-line tool:nixgcloud initgcloud container clusters get-credentials [Your cluster name] --zone [Your zone] --project [Your project name]nixgcloud initgcloud container clusters get-credentials [Your cluster name] --zone [Your zone] --project [Your project name] -
Check that you can access the cluster by calling
kubectl get pods
:nixkubectl get podsnixkubectl get podsIf your cluster is new it may not have any resources:
outputtextNo resources found in default namespace.outputtextNo resources found in default namespace.
Install Jump to heading
Choose one of the following installation methods:
Install with Helm Jump to heading
Helm values file
The following example uses --set
invocations to configure the ingress controller. When installing with Helm, you can instead use a Helm values file to provide your configuration values. Using a Helm values file can provide for better traceability of configuration changes and reduce the complexity of Helm installation commands.
-
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 the latest version of the ingress controller with
type
set toLoadBalancer
:nixhelm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \--create-namespace \--namespace haproxy-controller \--set controller.service.type=LoadBalancernixhelm install haproxy-kubernetes-ingress haproxytech/kubernetes-ingress \--create-namespace \--namespace haproxy-controller \--set controller.service.type=LoadBalancerThis 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 useIngress
resources only if they specifyingressClassName: haproxy
. You can disable this by setting--set controller.ingressClass=null
when callinghelm install
.This change was introduced in version 1.6.
Install with kubectl Jump to heading
-
Download the latest source code from the HAProxy Kubernetes Ingress Controller GitHub page.
-
Edit the file
deploy/haproxy-ingress.yaml
. -
Change the Service resource in
haproxy-ingress.yaml
, setting itstype
field toLoadBalancer
, which is the preferred mode when running in the cloud:haproxy-ingress.yamlyamlapiVersion: v1kind: Servicemetadata:labels:run: haproxy-ingressname: haproxy-ingressnamespace: haproxy-controllerspec:selector:run: haproxy-ingresstype: LoadBalancerports:- name: httpport: 80protocol: TCPtargetPort: 80- name: httpsport: 443protocol: TCPtargetPort: 443- name: statport: 1024protocol: TCPtargetPort: 1024haproxy-ingress.yamlyamlapiVersion: v1kind: Servicemetadata:labels:run: haproxy-ingressname: haproxy-ingressnamespace: haproxy-controllerspec:selector:run: haproxy-ingresstype: LoadBalancerports:- name: httpport: 80protocol: TCPtargetPort: 80- name: httpsport: 443protocol: TCPtargetPort: 443- name: statport: 1024protocol: TCPtargetPort: 1024 -
Use the
kubectl apply
command to deploy the controller:nixkubectl apply -f haproxy-ingress.yamlnixkubectl apply -f haproxy-ingress.yamlThis 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
:
nix
kubectl get pods --namespace haproxy-controller
nix
kubectl get pods --namespace haproxy-controller
outputtext
NAME READY STATUS RESTARTS AGEhaproxy-kubernetes-ingress-7dd4cc4b-x5fkv 1/1 Running 0 1m
outputtext
NAME READY STATUS RESTARTS AGEhaproxy-kubernetes-ingress-7dd4cc4b-x5fkv 1/1 Running 0 1m
Get the External IP, which you can use to access your cluster:
nix
kubectl get services --namespace haproxy-controller
nix
kubectl get services --namespace haproxy-controller
outputtext
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEhaproxy-kubernetes-ingress LoadBalancer 10.8.14.69 34.68.15.92 80:32693/TCP,443:30866/TCP,1024:32181/TCP 45s
outputtext
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEhaproxy-kubernetes-ingress LoadBalancer 10.8.14.69 34.68.15.92 80:32693/TCP,443:30866/TCP,1024:32181/TCP 45s
Do you have any suggestions on how we can improve the content of this page?