<p>Can any body explain istio Subsets and destination rules in a a simple manner and explain the problem they are trying to solve by introducing the subsets.</p>

<p><code>DestinationRule</code> is a resource that adds additional routing policies after routing happens to a <code>Service</code>, for example say that you have the following service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: default
spec:
  selector:
    app: my-service
  ports:
    - name: http
      protocol: TCP
      port: 80
</code></pre>
<p>This <code>Service</code> can route to multiple resources, it picks up any pod which contains label <code>app: my-service</code>, which means you can have, for example, different versions of the same service running in parallel using one deployment for each.</p>
<p>Now, with a <code>DestinationRule</code> you can add additional routing policies on top of that, a subset means part of your pods which you can identify through labels, for example:</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: my-service-ab
spec:
  host: my-service.default.svc.cluster.local
  trafficPolicy:
    loadBalancer:
      simple: LEAST_CONN
  subsets:
  - name: a-test
    labels:
      version: v3
    trafficPolicy:
      loadBalancer:
        simple: ROUND_ROBIN
</code></pre>
<p>This <code>DestinationRule</code> uses a round robin load balancing policy for all traffic going to a subset named a-test that is composed of endpoints (e.g., pods) with labels (version:v3). This can be useful for scenarios such as A/B testing, or to keep multiple versions of you service running in parallel.</p>
<p>Also, you can specify custom <a href="https://istio.io/latest/docs/reference/config/networking/destination-rule/#TrafficPolicy" rel="nofollow noreferrer">TrafficPolicies</a> for a subset that will override TrafficPolicies defined at a Service level.</p>
