K8S-ingress + 域名: 外部访问集群方式。
127.0.0.1 timeserver.example.com
127.0.0.1 robohash.example.com
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: timeserver-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
ingressClassName: nginx
rules:
- host: timeserver.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: timeserver-internal
port:
number: 80
- host: robohash.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: robohash-internal
port:
number: 80
http://timeserver.example.com
http://robohash.example.com
https://timeserver.example.com
https://robohash.example.com
作者:ChenLuLouis
出处:http://www.cnblogs.com/chenlulouis/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
该文章也同时发布在我的独立博客中-chenlulouisBlog。
posted on 2025-04-03 14:47 chenlulouis 阅读(17) 评论(0) 收藏 举报