Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Istio destination rule subsets not working

MY istio destintion rules are not working, getting below error in kiali

enter image description here VirtualService and destination rule for echo service:

My calling echo-svc:8080 and echo-svc:8080/v1 from my another virtualservices , I'm not able to do route in specific version.

When making request from another virtualservice: echo-svc:8080/v1 or echo-svc:8080, I'm getting response from both the subsets.

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: echo-vsvc
spec:
  hosts:
  - "echo-svc.default.svc.cluster.local"
  http:
  - match:
    - uri:
        prefix: "/v1"
    route:
    - destination:
        host: echo-svc.default.svc.cluster.local
        subset: v1
  - route:
    - destination:
        host: echo-svc.default.svc.cluster.local
        subset: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: echo-destination
spec:
  host: echo-svc.default.svc.cluster.local
  subsets:
  - name: v1
    labels:
      version: v0.1
  - name: v2
    labels:
      version: v0.2

If I'm attaching my echo-service to gateway and then making service to v1 endpoint via istio-ingress, my all requests are routed to required k8s service, but if it's internal(echo service not attached to gateway) envoy is not routing the requests to required k8s service..

Update:

 $ > k get pods --show-labels
NAME                              READY   STATUS    RESTARTS   AGE     LABELS
echo-deploy-v1-bdf758994-8f54b    2/2     Running   0          2m56s   app=echo-app,pod-template-hash=bdf758994,version=v0.1
echo-deploy-v2-68bb64684d-9gg2r   2/2     Running   0          2m51s   app=echo-app,pod-template-hash=68bb64684d,version=v0.2
frontend-v2-569c89dbd8-wfnc4      2/2     Running   2          12h     app=frontend,pod-template-hash=569c89dbd8,version=v2
like image 370
Sumit Murari Avatar asked Jan 21 '26 23:01

Sumit Murari


1 Answers

Found my mistake, for istio destination rules to work be very careful about these: https://istio.io/docs/setup/kubernetes/spec-requirements/.

My mistake was of named port for service. Updating it from "web" to "http-web" worked for me. It should be of form : <protocol>[-<suffix>]

---
apiVersion: v1
kind: Service
metadata:
  name: echo-svc
  labels:
    app: echo-app
spec:
  ports:
  - port: 80
    targetPort: 8080
    name: http-web
  selector:
    app: echo-app
---
like image 153
Sumit Murari Avatar answered Jan 24 '26 17:01

Sumit Murari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!