I'm trying to run an NGINX reverse proxy, which is publicly exposed, without a loadbalancer. I want to curl the VM IP on port 80 with the ingress path specified and see my nginx setup page.
I installed this NGINX controller:
https://kubernetes.github.io/ingress-nginx/deploy/#digital-ocean
Ingress
...
spec:
ingressClassName: nginx
rules:
- http:
paths:
- backend:
service:
name: webserver-srv
port:
number: 80
path: /
pathType: Prefix
I've modified the externalIP
on the ingress controller to point to my VM like so:
(This is what allows the port 80 to open up when I run netcat)
spec:
externalIPs:
- my.ip.goes.here
I can successfully validate that the port is open nc -vz <IP> 80
, however I just get empty reply from the server
.
I have a basic nginx webserver running as the service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: webserver-depl
spec:
replicas: 1
selector:
matchLabels:
app: webserver
template:
metadata:
labels:
app: webserver
spec:
containers:
- name: webserver
image: nginx
---
apiVersion: v1
kind: Service
metadata:
name: webserver-srv
spec:
selector:
app: webserver
type: ClusterIP
ports:
- name: webserver
protocol: TCP
port: 80
targetPort: 80
I can curl the clusterIP of the service and it works as expected:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>