自建kubernetes ingress-nginx 和ingress-istio 暴露服务端口
istio,ingress-nginx,traefik
Traefik 与之类似
自建K8S服务暴露端口
文档说明:自建K8S,只记录关键地方;
只介绍 ingress-nginx 和 ingress-istio (Traefik 与之述类似)
- ingress-nginx
- ingress-istio
关键点
| type: NodePort |
| externalIPs: |
| - 192.168.3.121 |
| - 192.168.3.122 |
| - 192.168.3.123 |
ingress service 组件--ingress-nginx
方法一,修改配置文件
| apiVersion: v1 |
| kind: Service |
| metadata: |
| labels: |
| app.kubernetes.io/component: controller |
| app.kubernetes.io/instance: ingress-nginx |
| app.kubernetes.io/name: ingress-nginx |
| app.kubernetes.io/part-of: ingress-nginx |
| app.kubernetes.io/version: 1.4.0 |
| name: ingress-nginx-controller |
| namespace: ingress-nginx |
| spec: |
| ipFamilies: |
| - IPv4 |
| ipFamilyPolicy: SingleStack |
| ports: |
| - appProtocol: http |
| name: http |
| port: 80 |
| protocol: TCP |
| targetPort: http |
| - appProtocol: https |
| name: https |
| port: 443 |
| protocol: TCP |
| targetPort: https |
| selector: |
| app.kubernetes.io/component: controller |
| app.kubernetes.io/instance: ingress-nginx |
| app.kubernetes.io/name: ingress-nginx |
| type: NodePort |
| externalIPs: |
| - 192.168.3.121 |
| - 192.168.3.122 |
| - 192.168.3.123 |
| |
方法二: 命令行里 kubectl edit 编辑配置文件
| kubectl edit service/ingress-nginx-controller -n ingress-nginx |
| |
| type: NodePort |
| externalIPs: |
| - 192.168.3.121 |
| - 192.168.3.122 |
| |
ingress service 组件--istio
| |
| |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| annotations: null |
| labels: |
| app: istio-ingressgateway |
| istio: ingressgateway |
| release: istio |
| name: istio-ingressgateway-my-custom |
| namespace: istio-system |
| spec: |
| ports: |
| - name: http2 |
| port: 80 |
| targetPort: 8080 |
| - name: https |
| port: 443 |
| targetPort: 8443 |
| selector: |
| app: istio-ingressgateway |
| istio: ingressgateway |
| type: NodePort |
| externalIPs: |
| - 192.168.3.121 |
| - 192.168.3.122 |
| |
| |
方法二: 命令行里 kubectl edit 编辑配置文件
| |
| kubectl edit service/istio-ingressgateway -n istio-system |
| |
| type: NodePort |
| externalIPs: |
| - 192.168.3.121 |
| - 192.168.3.122 |
| |
参考文档
- ingress-controllers
- ingress service
- ingress-nginx部署
- ingress-nginx部署源文件
- istio-ingress部署
- istio-ingress 使用--profile=default模式就够了
- traefik-ingress
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术