使用ClusterIP类型的Ingress暴露服务是否可行?
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-service
ports:
- name: my-service-port
port: 4001
targetPort: 4001
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: my.example.com
http:
paths:
- path: /my-service
backend:
serviceName: my-service
servicePort: 4001
我知道服务可以使用NodePort类型暴露,但这可能会增加一个NAT连接。如果有人能向我展示如何在云中从互联网快速检测内部服务,那就太好了。