[英]kubernetes expose nginx to static ip in gcp with ingress service configuration error
I had a couple of questions regarding kubernetes ingress service [/controllers] 关于kubernetes入口服务[/ controllers],我有几个问题
For example I have an nginx frontend image that I am trying to run with kubectl - 例如,我有一个要与kubectl一起运行的nginx前端图像-
kubectl run <deployment> --image <repo> --port <internal-nginx-port>.
Now I tried to expose this to the outer world with a service - 现在,我尝试通过服务将其公开给外部世界-
kubectl expose deployment <deployment> --target-port <port>.
Then tried to create an ingress service with the following nignx-ing.yaml - 然后尝试使用以下nignx-ing.yaml创建入口服务-
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: urtutorsv2ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: "coreos"
spec:
backend:
serviceName: <service>
servicePort: <port>
Where my ingress.global-static-ip-name
is correctly created & available in Google cloud console. 我的ingress.global-static-ip-name
正确创建并在Google云控制台中可用的位置。 [I am assuming the service port here is the port I want on my "coreos" IP , so I set it to 80 initially which didn't work so I tried setting it same as the specified in the first step but it still didn't work.] [我假设这里的服务端口是我想要在我的“ coreos” IP上使用的端口,所以我最初将其设置为80,这是行不通的,因此我尝试将其设置为第一步中指定的端口,但仍然没有工作。]
So, the issue is I am not able to access the frontend at both the urls http://COREOS_IP , http://COREOS_IPIP : 所以,问题是我无法同时访问两个URL http:// COREOS_IP , http:// COREOS_IPIP的前端 :
Which is why I tried to use - 这就是为什么我尝试使用-
kubectl expose deployment <deployment> --target-port <port>. --type NodePort
to see if it worked with a NodePort & I was able to access the frontend. 看看它是否可以与NodePort一起使用,并且我能够访问前端。
So, I am thinking there might be a configuration mistake here because of which I am not getting results with the ingress. 因此,我认为这里可能存在配置错误,因此我无法通过入口获得结果。
Can anyone here help debug / fix the issue ? 这里有人可以帮助调试/解决问题吗?
Yeah, the service is there. 是的,服务在那里。 I tried to check the status with - kubectl get services, kubectl describe service k8urtutorsv2. 我试图用-kubectl获取服务,kubectl描述服务k8urtutorsv2来检查状态。 It showed the service. 它显示了服务。 I tried editing it & saved the nodeport value. 我尝试编辑它并保存了nodeport值。 the thing is it works with nodeport but not 80 or 443. 问题是它与nodeport兼容,但不适用于80或443。
You cannot directly expose service on the port 80 or 443. 您不能直接在端口80或443上公开服务。
The available range of exposed services is predefined in the kube-api configuration by the service-node-port-range
option with the default value 30000-32767
. 公开服务的可用范围是在kube-api配置中通过service-node-port-range
选项预定义的, 默认值为 30000-32767
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.