2e1d11ad69 | ||
---|---|---|
.. | ||
ci | ||
templates | ||
.helmignore | ||
Chart.yaml | ||
README.md | ||
app-readme.md | ||
questions.yml | ||
values.yaml |
README.md
HAProxy Kubernetes Ingress Controller
An ingress controller is a Kubernetes resource that routes traffic from outside your cluster to services within the cluster. HAProxy Kubernetes Ingress Controller uses ConfigMap to store the haproxy configuration.
Detailed documentation can be found within the Official Documentation.
Additional configuration details can be found in annotation reference and in image arguments reference.
Introduction
This chart bootstraps an HAProxy kubernetes-ingress deployment/daemonset on a Kubernetes cluster using the Helm package manager.
Prerequisites
- Kubernetes 1.12+
- Helm 2.9+
Before you begin
Setup a Kubernetes Cluster
The quickest way to setup a Kubernetes cluster is with Azure Kubernetes Service, AWS Elastic Kubernetes Service or Google Kubernetes Engine using their respective quick-start guides.
For setting up Kubernetes on other cloud platforms or bare-metal servers refer to the Kubernetes getting started guide.
Install Helm
Get the latest Helm release.
Add Helm chart repo
Once you have Helm installed, add the repo as follows:
helm repo add haproxytech https://haproxytech.github.io/helm-charts
helm repo update
Install the chart
To install the chart with Helm v3 as my-release deployment:
helm install my-release haproxytech/kubernetes-ingress
NOTE: To install the chart with Helm v2 (legacy Helm) the syntax requires adding deployment name to --name
parameter:
helm install haproxytech/kubernetes-ingress \
--name my-release
Installing with unique name
To auto-generate controller and its resources names when installing, use the following:
helm install haproxytech/kubernetes-ingress \
--generate-name
Installing from a private registry
To install the chart using a private registry for controller into a separate namespace prod.
NOTE: Helm v3 requires namespace to be precreated (eg. with kubectl create namespace prod
)
helm install my-ingress haproxytech/kubernetes-ingress \
--namespace prod \
--set controller.image.tag=SOMETAG \
--set controller.imageCredentials.registry=myregistry.domain.com \
--set controller.imageCredentials.username=MYUSERNAME \
--set controller.imageCredentials.password=MYPASSWORD
Installing as DaemonSet
Default controller mode is Deployment, but it is possible to use DaemonSet as well:
helm install my-ingress2 haproxytech/kubernetes-ingress \
--set controller.kind=DaemonSet
Installing in multi-ingress environment
It is also possible to set controller ingress class to be used in multi-ingress environments:
helm install my-ingress3 haproxytech/kubernetes-ingress \
--set controller.kind=DaemonSet \
--set controller.ingressClass=haproxy
NOTE: make sure your Ingress routes have corresponding ingress.class: haproxy
annotation.
Installing with service annotations
On some environments like EKS and GKE there might be a need to pass service annotations. Syntax can become a little tedious however:
helm install my-ingress3 haproxytech/kubernetes-ingress \
--set controller.kind=DaemonSet \
--set controller.ingressClass=haproxy \
--set controller.service.type=LoadBalancer \
--set controller.service.annotations."service\.beta\.kubernetes\.io/aws-load-balancer-internal"="0.0.0.0/0" \
--set controller.service.annotations."service\.beta\.kubernetes\.io/aws-load-balancer-cross-zone-load-balancing-enabled"="true"
NOTE: With helm --set
it is needed to put quotes and escape dots in the annotation key and commas in the value string.
Installing with Horizontal Pod Autoscaler
HPA automatically scales number of replicas in Deployment or Replication Controller and adjusts replica count. Therefore we want to unset default replicaCount for controller and defaultBackend by setting corresponding key values to null:
helm install my-ingress4 haproxytech/kubernetes-ingress \
--set controller.replicaCount=null \
--set defaultBackend.replicaCount=null
Using values from YAML file
As opposed to using many --set
invocations, much simpler approach is to define value overrides in a separate YAML file and specify them when invoking Helm:
mylb.yaml:
controller:
kind: DaemonSet
ingressClass: haproxy
service:
type: LoadBalancer
annotations:
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: 'true'
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
And invoking Helm becomes (compare to the previous example):
helm install my-ingress4 -f mylb.yml haproxytech/kubernetes-ingress
A typical YAML file for TCP services looks like (provided that configmap "default/tcp" was created) :
controller:
service:
tcpPorts:
- name: mysql
port: 3306
targetPort: 3306
extraArgs:
- --configmap-tcp-services=default/tcp
Upgrading the chart
To upgrade the my-release deployment:
helm upgrade my-release haproxytech/kubernetes-ingress
Uninstalling the chart
To uninstall/delete the my-release deployment:
helm delete kubernetes-ingress
Debugging
It is possible to generate a set of YAML files for testing/debugging:
helm install my-release haproxytech/kubernetes-ingress \
--debug \
--dry-run
Contributing
We welcome all contributions. Please refer to guidelines on how to make a contribution.