I'm trying to create an nginx-ingress for my 2 services without LB. First, I create nginx_ingress.yaml
:
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app: ingress-nginx
spec:
selector:
app: ingress-nginx
type: NodePort
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https
---
And then echo_ingress.yaml
:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echo-ingress
spec:
rules:
- host: subdomain1.example.com
http:
paths:
- backend:
serviceName: echo1
servicePort: 80
- host: subdomain2.example.com
http:
paths:
- backend:
serviceName: echo2
servicePort: 80
But, when ingress was created, it doesn't show its address and it seems not running properly, I cannot get anything from port 80 on curl
:
NAME HOSTS ADDRESS PORTS AGE
echo-ingress git.satelkom.co.id,op.satelkom.co.id 80 8m9s
What's going wrong here?
If you try to define path ?
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echo-ingress
spec:
rules:
- host: subdomain1.example.com
http:
paths:
- backend:
serviceName: echo1
servicePort: 80
path: / # <--- Add this tag
- host: subdomain2.example.com
http:
paths:
- backend:
serviceName: echo2
servicePort: 80
path: / # <--- Add this tag
Or define external IPs on ingress service
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app: ingress-nginx
spec:
externalIPs: # <-- Try to add this 2 lines
- <YOUR IP LAN or WAN>
selector:
app: ingress-nginx
type: NodePort
ports:
- name: http
port: 80
targetPort: http # <-- Replace by port number: 80
- name: https
port: 443
targetPort: https # <-- Replace by port number: 443