问题
I am using the Istio sidecar injection. I have two namespaces in my cluster with istio-enabled. Below mentioned are two namespaces i.e bk and abhi. Also, I have a separate gateway for each namespace.
The following is for bk namespace.
I want to Access service by Ingress for bk namespace.
bk.localhost.cluster
Below is Gateway for bk namespace :
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: abhijeet
namespace: bk
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- bk.localhost.cluster
port:
name: http
number: 80
protocol: HTTP
Below in VirtualService for bk namespace:-
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
generation: 58
name: bk
namespace: bk
spec:
gateways:
- abhijeet
hosts:
- bk.localhost.cluster
http:
- match:
uri:
prefix: /pune
route:
- destination:
host: wagholi
port:
number: 8080
- match:
uri:
prefix: /pune/{location}
route:
- destination:
host: yerwada
port:
number: 8080
The following is for abhi namespace.
I want to Access service by Ingress for abhi namespace.
abhi.localhost.cluster
Below is Gateway for abhi namespace :
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: thebk
namespace: abhi
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- abhi.localhost.cluster
port:
name: http
number: 80
protocol: HTTP
Below in VirtualService for abhi namespace:-
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: abhi
namespace: abhi
spec:
gateways:
- thebk
hosts:
- abhi.localhost.cluster
http:
- match:
uri:
prefix: /pune
route:
- destination:
host: wagholi
port:
number: 8080
- match:
uri:
prefix: /pune/{location}
route:
- destination:
host: yerwada
port:
number: 8080
I am getting a 404 error in postman.
404 Not Found
来源:https://stackoverflow.com/questions/60237159/i-want-to-have-separate-host-address-for-two-namespaces-in-k8s-clusters-having-s