请求 Ingress 时无响应,无法访问后端服务。
请求 Ingress 时,需要经过 Ingress、Service、Pod,逐个排查每个环节是否正常。排查步骤如下:
kubectl get ingress test-ingress -n default -oyaml
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: test-ingress namespace: default spec: ingressClassName: nginx rules: - host: test.com http: paths: - backend: service: name: test port: number: 3001 path: / pathType: Prefix status: loadBalancer: {}
kubectl get service test -n default NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE test ClusterIP xxx.xxx.xxx.xx <none> 443/TCP 1h
kubectl get ep test -n default NAME ENDPOINTS AGE platform xxx.xxx.xxx.xxx:3001,xxx.xxx.xxx.xxx:3001 1h