Host2 (子域)工作完美,主机1给出错误消息‘默认后端- 404’。web1和web2的两个文件都在本地机器上工作,除了名称变量、nodePort和图像位置等外,YAML文件几乎是相同的。
有什么不对的地方吗?
Ingress配置:
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: 80YAML 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发布于 2019-10-30 12:58:48
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我觉得这个应该管用。我也使用相同的配置。请纠正yaml中的缩进问题,我在这里发帖
https://stackoverflow.com/questions/47952393
复制相似问题