I installed istio on minikube and deployed sample application.
Everything works normal except i cannot get request between microservices.
Products service is listening on :9080 /products route.
The urls i tried:
But none of them did not worked.
await axios.get('products:9080/products')
await axios.get('blog-products:9080/products')
If i run this command, it works but when i try to run that url inside microservice-1 it does not work.
kubectl exec -it $(kubectl get pod -l app=products -o jsonpath='{.items[0].metadata.name}') -c products -- curl products:9080/products
blog.yaml for service definitions
#blog.yaml
##################################################################################################
# Products service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: products
labels:
app: products
service: products
spec:
ports:
- port: 9080
name: http
selector:
app: products
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: blog-products
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: products-v1
labels:
app: products
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: products
version: v1
template:
metadata:
labels:
app: products
version: v1
spec:
serviceAccountName: blog-products
containers:
- name: products
image: s1nc4p/blogproducts
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# home services
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: home
labels:
app: home
service: home
spec:
ports:
- port: 9080
name: http
selector:
app: home
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: blog-home
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: home-v1
labels:
app: home
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: home
version: v1
template:
metadata:
labels:
app: home
version: v1
spec:
serviceAccountName: blog-home
containers:
- name: home
image: s1nc4p/bloghome:v4
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
blog.gateway.yaml
#blog.gateway.yaml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: blog-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: blog
spec:
hosts:
- "*"
gateways:
- blog-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
host: home
port:
number: 9080