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

时间:2020-05-29 05:12:34

标签: flask kubernetes kubernetes-ingress

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

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

有人可以帮我吗?

1 个答案:

答案 0 :(得分:2)

  1. 您需要描述所使用的k8。 (例如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配置看起来不错。