I have installed the HAProxy controller in AKS by following the documentation here https://www.haproxy.com/documentation/kubernetes/latest/installation/community/azure/. When I try to navigate the External load balancer IP as expected I was getting 404. then I have deployed a new app by using the hello world image to the same namespace.
apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-helloworld-one
spec:
replicas: 1
selector:
matchLabels:
app: aks-helloworld-one
template:
metadata:
labels:
app: aks-helloworld-one
spec:
containers:
- name: aks-helloworld-one
image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
ports:
- containerPort: 80
env:
- name: TITLE
value: "Welcome to Azure Kubernetes Service (AKS)"
---
apiVersion: v1
kind: Service
metadata:
name: aks-helloworld-one
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
ports:
- name: http-port
port: 8000
protocol: TCP
targetPort: 80
selector:
app: aks-helloworld-one
then I have added the path to ingress file with the following
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: test
spec:
ingressClassName: haproxy
rules:
- http:
paths:
- path: /helloworld
pathType: Prefix
backend:
service:
name: aks-helloworld-one
port:
number: 80
and deployed. post that if I navigate to external load balancer ip /helloworld is still returning 404. I am not sure what I am doing wrong. here is the current list of services in the namespace
PS \HA Proxy> kubectl get svc --namespace haproxy-controller
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
aks-helloworld-one ClusterIP 10.0.206.176 8000/TCP
haproxy-kubernetes-ingress LoadBalancer 10.0.138.212 ..**.**8 80:30778/TCP,443:32570/TCP,1024:31481/TCP
The Ingress will redirect to the service and the service to the pod.
So in the Ingress service.port it needs to be set to 8000 (that is the port set in the service with a target port 80 for the pod).