我有一个谷歌 Kubernetes 引擎正在运行。我制作了一个 ASP.NET 核心MVC应用程序,该应用程序作为引擎上的服务部署,我希望能够从其他应用程序向该服务发出HTTP请求(GET http:serviceendpointip/controller/action
(。我使用 ngrok 测试了我的 MVC 应用程序(为我的应用程序提供公共 URL(,并且请求成功运行。
所以我的应用程序似乎工作正常。但是,当我将其部署为 Kubernetes 引擎的公开公共服务时,请求不起作用,我假设引擎以某种方式阻止了此网络流量......我能够在http://serviceendpointip/home
上从网络浏览器查看应用程序的主页。什么可能导致我的 HTTP 请求失败?
运行kubectl describe deployment telebot-pianomoves-v1-km
:
Namespace: default
CreationTimestamp: Tue, 28 Aug 2018 21:34:03 +1000
Labels: run=telebot-pianomoves-v1-km
Annotations: deployment.kubernetes.io/revision=12
kubernetes.io/change-cause=kubectl set image
deployment/telebot-pianomoves-v1-km telebot-pianomoves-v1-
km=gcr.io/telebot-pianomoves-v1/tel
ebot-pianomoves-v1-km:20180907t124111 --record=true --kubeconf...
Selector: run=telebot-pianomoves-v1-km
Replicas: 3 desired | 2 updated | 4 total | 1 available | 3
unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 1 max unavailable, 1 max surge
Pod Template:
Labels: run=telebot-pianomoves-v1-km
Containers:
telebot-pianomoves-v1-km:
Image: gcr.io/telebot-pianomoves-v1/telebot-pianomoves-v1-
km:20180907t124111
Port: 8080/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available False MinimumReplicasUnavailable
OldReplicaSets: telebot-pianomoves-v1-km-7775cfb674 (1/1 replicas
created), telebot-pianomoves-v1-km-cf4f5d9d8 (1/1 replicas created)
NewReplicaSet: telebot-pianomoves-v1-km-7b78d6597d (2/2 replicas
created)
Events: <none>
运行kubectl get deployments
:
telebot-pianomoves-v1-km 3 4 2 1 9d
谢谢
我已经设法解决了我的问题。我通过从Visual Studio发布到Kubernetes Engine并确保将副本数量设置为1来实现这一点。