任何人都知道为什么我不断获得以下 YAML 代码的服务不可用。入口指向指向容器的服务,它应该可以工作。对于这个例子,我只是使用 NGINX 容器进行测试。
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
selector:
k8s-app: traefik-ingress-lb
app: nginx
ports:
- name: web
port: 80
targetPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: frontend
spec:
rules:
- host: test.example.services
http:
paths:
- path: /
backend:
serviceName: frontend
servicePort: web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.15.4
ports:
- containerPort: 80
---