小编vis*_*lle的帖子

为什么入口“ servicePort”可以是服务的“端口”和“ targetPort”?

今天我面对误会servicePort

我预计,服务可以与入口仅指定链接servicePort: 80,但都servicePort: 80servicePort: 8080作品。

有人可以帮助我理解为什么端口port和端口targetPort不仅会通过服务公开port吗?

服务(应用程序)

spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: 8080
Run Code Online (Sandbox Code Playgroud)

入口(ingress-nginx)

spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: app
          servicePort: 8080
Run Code Online (Sandbox Code Playgroud)

kubernetes

2
推荐指数
1
解决办法
5127
查看次数

标签 统计

kubernetes ×1