NGINX Ingress Controller - 405 Not Allowed

11/24/2019

I have developed a spring boot app (User Registration app) that has one rest API. The rest API inserts the data in a MySQL. The application and database have been deployed in GCP Kubernetes and everything was working fine as I was using network load balancer. Now I am trying to use NGINX Ingress Controller and Path-based Ingress routing. A network load balancer is pointing to NGINX Ingress Controller and Load Balancer IP is tagged to a wild card host name in Cloud DNS.

From PostMan application whenever I am trying to hit the "User Registration App" using the DNS url it's throwing an error:

<html>
<head>
    <title>405 Not Allowed</title>
</head>
<body>
    <center>
        <h1>405 Not Allowed</h1>
    </center>
    <hr>
    <center>openresty</center>
</body>
</html>

I am trying to provide all the details I have right. Can provide more details if required. I am not able to understand why NGINX server is throwing "405 Not allowed error".

User Registration Spring Boot App

Spring Boot App Controller - POST method receive the input data

NGINX Controller

Followed the steps mentioned here: https://kubernetes.github.io/ingress-nginx/deploy/#detect-installed-version

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

Ingress Controller Service

Kubernetes Services:

Services Running in Kubernetes Cluster - Refer Yellow marked

Kubernetes Pods:

Pods running in Kubernetes Cluster - Refer Yellow marked

Ingress YML:

`
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: fanout-ingress
  namespace: xyz-product
  labels:                     # Labels that will be applied to this resource
    app: prod-user-reg-app
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"
spec:
  rules:
  - host: test.apps.myproduct.com
    http:
      paths:
      - path: /user-reg/create/*
        backend:
          serviceName: prod-user-reg-create-app
          servicePort: 8081`

Kubctl Describe Ingress

GCP Cloud DNS

How do solve the issue? And where is the problem? In NGINX Controller service?

Please help.

-- Suvendu Mandal
google-cloud-platform
kubernetes
nginx
spring-boot

1 Answer

11/26/2019

The resolution is here. Changed the URL path and used a registered domain to access via the internet.

https://github.com/kubernetes/ingress-nginx/issues/4772 and https://github.com/kubernetes/ingress-nginx/issues/4776

-- Suvendu Mandal
Source: StackOverflow