Why is my Ingress Nginx serving HTTPS instead of HTTP in production?

0
5
Asked By TechGuru77 On

I've got two environments set up, test and prod, both created with the same Terraform template, so they should be identical in configuration. Each cluster has Argo CD installed. The test cluster works well, but in the prod environment, I'm hitting a 502 Bad Gateway error. It seems like the Ingress Nginx is trying to connect via the HTTPS port, even though my ingress manifest specifies HTTP. Both Argo CD instances have the insecure flag set to true and are served on paths. When I port-forward to Argo CD directly, it works fine in both cases. Here's a snippet of the ingress configuration I'm using:

```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argo-cd
namespace: argocd
labels:
app.kubernetes.io/name: argo-cd
app.kubernetes.io/managed-by: manually-deployed
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /prod/argo-cd
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: http
```

The only thing that's different between the test and prod environments is the path. I can access the test environment without issues, but when I try the prod environment, it results in a 502 error and shows that it's trying to use the argo-cd-server-https. Can anyone help me figure out why this is happening?

2 Answers

Answered By CloudWizard99 On

It looks like you have the annotation `nginx.ingress.kubernetes.io/force-ssl-redirect: "true"` in your configuration, which might be causing issues since it forces redirection to HTTPS. That might be why the production setup is trying to use the HTTPS port. You might want to remove that and see if it resolves the issue.

Answered By KubeMaster27 On

Just a heads up, you have the annotation for backend protocol set to HTTP already. So that shouldn't be the problem. You might need to check how your service is actually configured in production compared to test.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.