入口未将流量转发到吊舱



Ingress没有将流量转发到pod。应用程序已部署在Azure内部网络上。我可以使用pod Ip和端口成功访问应用程序,但当尝试Ingress Ip/Host时,我得到404,但找不到。我在Ingress日志中没有看到任何错误。Bellow是我的配置文件。如果我遗漏了什么,请帮助我,或者我可以如何解决问题。

部署.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-helloworld-one
spec:
replicas: 1
selector:
matchLabels:
app: aks-helloworld-one
template:
metadata:
labels:
app: aks-helloworld-one
spec:
containers:
- name: aks-helloworld-one
image: <image>
ports:
- containerPort: 8290
protocol: "TCP"
env:
- name: env1
valueFrom:
secretKeyRef:
name: configs
key: env1
volumeMounts:
- mountPath: "mnt/secrets-store"
name: secrets-mount
volumes:      
- name: secrets-mount
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "azure-keyvault"
imagePullSecrets:
- name: acr-secret
---
apiVersion: v1
kind: Service
metadata:
name: aks-helloworld-one
spec:
type: ClusterIP
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8290
selector:
app: aks-helloworld-one

Ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world-ingress
namespace: ingress-basic
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: aks-helloworld
port:
number: 80

在ingress.yaml.中更正您的服务名称和服务端口

spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
# wrong: name: aks-helloworld
name: aks-helloworld-one  
port:
# wrong: number: 80
number: 8080

实际上,您可以使用下面的命令来确认ingress是否有任何端点。

kubectl describe ingress hello-world-ingress -n ingress-basic

您在ingress定义下提到了错误的服务名称。根据服务定义,服务名称应该是aks-helloworld一。

相关内容

  • 没有找到相关文章

最新更新