无法通过入口访问我的 Flask 服务器

Not able to access my Flask server through ingress

我对 Flask 和 k8s 的概念不熟悉,正在尝试通过 k8s 实现一个非常简单的 Flask 服务器以熟悉这个概念。 能够通过 NodePort 访问它。但是在 windows 机器中添加入口服务并调整我的主机文件之后。当我尝试访问我在 ingress-srv.yaml 中添加的主机 URL 时,出现 404 错误。

这是项目 Github link: https://github.com/bijay-ps/flask-poc

有人能帮帮我吗??

  1. 您需要描述您使用的是哪些k8s。 (例如 minikube、gcp、azure 等)以及客户端和服务器的版本
$ kubectl version                 
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T12:36:28Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.5-gke.6", GitCommit:"de3e4dcd39464bc1601edd66681e663bff1fe530", GitTreeState:"clean", BuildDate:"2020-05-12T16:10:21Z", GoVersion:"go1.13.9b4", Compiler:"gc", Platform:"linux/amd64"}
  1. 确保安装 Nginx Ingress Controller。没有默认(预安装)入口。
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.32.0/deploy/static/provider/cloud/deploy.yaml
  1. 您的 yaml 配置看起来没问题。