今天我面对误会servicePort。
我预计,服务可以与入口仅指定链接servicePort: 80,但都servicePort: 80和servicePort: 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 ×1