Install HAProxy Kubernetes Ingress Controller:
helm repo add haproxytech https://haproxytech.github.io/helm-charts
helm repo update
helm install kubernetes-ingress haproxytech/kubernetes-ingress \
--create-namespace \
--namespace haproxy-controller
Create tcp-services
ConfigMap that maps some port (e.g. 11587) to port 587 of connector-smtp service:
kubectl create configmap tcp-services -n haproxy-controller
kubectl patch configmap tcp-services -n haproxy-controller -p '{"data":{"11587":"my-namespace/connector-smtp:587"}}'
Edit ingress deployment (kubectl edit deployment.apps kubernetes-ingress -n haproxy-controller
startup argument:
spec:
containers:
- args:
# ...
- --configmap-tcp-services=haproxy-controller/tcp-services
Edit kubernetes-ingress service (kubectl edit svc kubernetes-ingress -n haproxy-controller
) and add port is mapped in ConfigMap:
ports:
# ...
- name: smtp
protocol: TCP
port: 11587
targetPort: 11587