[TOC]1、概述有些服务部署在k8s集群外部，但需要在k8s集群内部通过svc访问或ingress代理出来。集群外部部署nacos访问地址：http://192.168.203.40:88482、解决方式通过 Endpoints--->Svc(clusterip)--->ingress(nginx)解决3、创建yaml文件3.1、创建 endpoints yaml文件kind: Endpoints apiVersion: v1 metadata: name: svc-en-nacos namespace: dolab-namespace subsets: - addresses: - ip: 192.168.203.40 ports: - port: 8848 name: nacos-8848 appProtocol: http protocol: TCP3.2、创建svc yaml文件apiVersion: v1 kind: Service metadata: name: svc-en-nacos namespace: dolab-namespace spec: type: ClusterIP ports: - port: 8848 targetPort: 8848 protocol: TCP3.3、创建ingress yaml文件apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: svc-en-nacos namespace: dolab-namespace spec: ingressClassName: nginx rules: - host: http: paths: - path: /nacos pathType: Prefix backend: service: name: svc-en-nacos port: number: 88484、部署kubectl apply -f ./5、访问获取ingress地址kubectl get svc -A |grep nginx ingress-nginx ingress-nginx-controller LoadBalancer 10.98.140.199 192.168.203.131 80:31708/TCP,443:30325/TCP 18d ingress-nginx ingress-nginx-controller-admission ClusterIP 10.107.93.225 <none> 443/TCP 18访问http://192.168.203.131/nacos