简体   繁体   English

kubernetes将nginx暴露于gcp中的静态ip并带有入口服务配置错误

[英]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_IPhttp:// 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.

相关问题 在 Kubernetes 中顺序使用 Nginx Ingress 暴露服务 - Use Nginx Ingress sequentially in Kubernetes to expose service 如何在端口80/443的公共节点IP上公开kubernetes nginx-ingress服务? - How to expose kubernetes nginx-ingress service on public node IP at port 80 / 443? 通过 Kubernetes 上的 nginx 入口中的服务公开容器中的基本路径 - Expose basepath in container through service in nginx ingress on kubernetes kubernetes nginx 配置片段出现入口错误 - kubernetes nginx ingress error with configuration-snippet Configuring Static IP address with Ingress Nginx Sticky Session on Azure Kubernetes - Configuring Static IP address with Ingress Nginx Sticky Session on Azure Kubernetes 具有集群 ip 服务和默认 nginx 的 kubernetes 入口控制器无法按预期工作 - kubernetes ingress controller with cluster ip service and default nginx not working as expected kubernetes nginx 入口控制器错误 - kubernetes nginx ingress controller error Kubernetes ingress-nginx保留源IP - Kubernetes ingress-nginx preserve source IP Kubernetes nginx 入口证书错误 - Kubernetes nginx ingress Certificate Error Kubernetes nginx 通配符规则的入口配置 - Kubernetes nginx ingress configuration for wildcard rule
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM