0

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

threeleggedrabbit
  • 1,722
  • 2
  • 28
  • 60

1 Answers1

0

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).

paltaa
  • 2,985
  • 13
  • 28
  • 1
    I have updated, still it shows 404. BTW, I have tried to configure NGINX with the similar setting by providing port 80. that works – threeleggedrabbit Nov 08 '22 at 07:00
  • For some strange reason, using helm it works. helm install kubernetes-ingress haproxytech/kubernetes-ingress --create-namespace --namespace haproxy-controller --set controller.service.type=LoadBalancer, Yet to figure out the difference between the yaml – threeleggedrabbit Nov 08 '22 at 14:07