Я установил Kubernetes на голое железо и выяснил, как использовать Ingress и маршрутизировать хосты к моему сервису.
Но когда я использую одинаковую конфигурацию для другого хоста, я получаю default backend - 404
.
Рабочая конфигурация:
apiVersion: v1
kind: Namespace
metadata:
name: k8s-mariyo-host-1-sk-node-hello-world
---
apiVersion: v1
kind: Service
metadata:
namespace: k8s-mariyo-host-1-sk-node-hello-world
name: node-hello-world
labels:
app: node-hello-world
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: node-hello-world
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
namespace: k8s-mariyo-host-1-sk-node-hello-world
name: node-hello-world
spec:
selector:
matchLabels:
app: node-hello-world
strategy:
type: Recreate
template:
metadata:
namespace: k8s-mariyo-host-1-sk-node-hello-world
labels:
app: node-hello-world
spec:
containers:
- image: 10.100.100.1:5000/local-node-hello-world:1.5
name: hello-world
ports:
- containerPort: 8080
name: hello-world
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: k8s-mariyo-host-1-sk-node-hello-world
name: node-hello-world
spec:
rules:
- host: "node-hello-world.host-1.sk"
http:
paths:
- path: /
backend:
serviceName: node-hello-world
servicePort: 80
бэкэнд по умолчанию - конфигурация 404:
apiVersion: v1
kind: Namespace
metadata:
name: k8s-mariyo-host-2-sk-k8s
---
apiVersion: v1
kind: Service
metadata:
namespace: k8s-mariyo-host-2-sk-k8s
name: k8s
labels:
app: k8s
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: k8s
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
namespace: k8s-mariyo-host-2-sk-k8s
name: k8s
spec:
selector:
matchLabels:
app: k8s
strategy:
type: Recreate
template:
metadata:
namespace: k8s-mariyo-host-2-sk-k8s
labels:
app: k8s
spec:
containers:
- image: 10.100.100.1:5000/local-node-hello-world:1.5
name: k8s-hello
ports:
- containerPort: 8080
name: k8s-hello
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: k8s-mariyo-host-2-sk-k8s
name: k8s
spec:
rules:
- host: "k8s.host-2.sk"
http:
paths:
- path: /
backend:
serviceName: k8s
servicePort: 80
Кто-нибудь может увидеть, что может удивить /отличается поведение почти одинаковых конфигураций?Вот ссылка на diff: https://www.diffchecker.com/9AlnFQGz