我试图使用 Kubernetes 在本地设置服务。我正在使用 ingress-nginx 进行路由。我正在使用 Ubuntu 18.04。这是我的 ingress.yaml 文件:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
rules:
- host: ecommerce.dev
http:
paths:
- path: /api/users/?(.*)
backend:
serviceName: auth-srv
servicePort: 3000
另外,我在我的/etc/hosts/
文件中映射了这个:
127.0.0.1 localhost
127.0.1.1 TALHA
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 ecommerce.dev
当我尝试从浏览器访问“ecommerce.dev”时,我无法访问它,因为它显示“无法访问站点”。有人可以帮我吗?