Host2 (subdomain) works perfect, host 1 gives error message 'default backend - 404'. Both dockerfiles for web1 and web2 works on local machine and YAML files is almost identical except for name variables, nodePort and image location etc..
Any ideas what can be wrong here?
Ingress config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: test-ip
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: host1.com
http:
paths:
- path: /*
backend:
serviceName: web1
servicePort: 80
- host: sub.host1.com
http:
paths:
- path: /*
backend:
serviceName: web2
servicePort: 80
YAML for web1
apiVersion: v1
kind: Service
metadata:
name: web1
spec:
selector:
app: web1
type: NodePort
ports:
- name: http
protocol: TCP
port: 80
nodePort: 32112
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: web1-deployment
spec:
selector:
matchLabels:
app: web1
replicas: 1
metadata:
labels:
app: web1
spec:
terminationGracePeriodSeconds: 60
containers:
- name: web1
image: gcr.io/image..
imagePullPolicy: Always
ports:
- containerPort: 80
# HTTP Health Check
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 30
timeoutSeconds: 5
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: host1.com
http:
paths:
- path: /
backend:
serviceName: web1
servicePort: 80
- host: sub.host1.com
http:
paths:
- path: /
backend:
serviceName: web2
servicePort: 80
I think this should work. I am also using same config. Please correct indentation issues if any in the yaml, I posted here