Home > database >  Could not access Kubernetes Ingress
Could not access Kubernetes Ingress

Time:06-24

I am trying to run a mlflow server on Azure Kubernetes. I can access the server when attaching service to deployment as a Load Balancer. However, when I am trying to access the server using ingress it can't access it. However, when running the ingress public IP on port 80 I get Nginx server error 404 not found, which is expected but when running on mlflow server 5000 it is timed out.

Below are the manifest files for the deployment, Load Balancer service and Ingress.

Deployment:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mlflow-deployment
      labels:
        app: mlflow
    spec:
      selector:
        matchLabels:
          app: mlflow
      replicas: 1
      template:
        metadata:
          labels:
            app: mlflow
        spec:
          containers:
            - name: mlflow
              image: rjtshrm/mlflow:latest
              args: ["--backend-store-uri", "postgresql://psql:[email protected]:5432/postgres?sslmode=require", "--default-artifact-root", "wasbs://[email protected]", "--host", "0.0.0.0"]
              ports:
                - containerPort: 5000

Service: Load Balancer

    apiVersion: v1
    kind: Service
    metadata:
      name: mlflow
      labels:
        app: mlflow
    spec:
      selector:
        app: mlflow
      type: LoadBalancer
      ports:
        - port: 5000
          targetPort: 5000

Ingress:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: mlflow-server-ingress
      annotations:
        nginx.ingress.kubernetes.io/ssl-redirect: "false"
        nginx.ingress.kubernetes.io/use-regex: "true"
        nginx.ingress.kubernetes.io/rewrite-target: /$2
    spec:
      ingressClassName: mlflow-server-ingress
      rules:
        - http:
            paths:
              - path: /(.*)
                pathType: Prefix
                backend:
                  service:
                    name: mlflow
                    port:
                      number: 5000

Also, to install the Ingress controller I did the steps below.

    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm install ingress-nginx ingress-nginx/ingress-nginx  --namespace default   --set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz

Below it can be seen the services running in default namespace. The ingress-nginx-controller has a public IP which I can access on port 80 and get this error message 404 not found. Then for the Load Balancer, I can access the server with external IP on port 5000. Can be seen in the image

After applying the Ingress yaml file when I'm trying to access the ingress-nginx-controller on port 5000, the site can't be reached. the logs of ingress-nginx-controller here

PS: I have added the image and its args in the deployment file. It is public image with test Database credentials so that the whole thing can be tested.

CodePudding user response:

Is your .spec.ingressClassName field correct? I see you deployed nginx ingress controller.

CodePudding user response:

The nginx controller (at least the last time I used it) only listens on 80 and 443. So you can't use port 5000 on the ingress controller unless you set it via the helm chart values.

You can still use port 5000 on the service behind the ingress -- i.e. you are connecting nginx port 80/443 to your service's port 5000

  • Related