<p>I am new to Kubernetes. I created a server monitor and the selector select two services:</p>
<pre><code>apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: servicemonitor-sms-services
    release: kube-prom-stack
  name: servicemonitor-sms-config-services
  namespace: metrics
spec:
  selector:
    matchLabels:
      app: a-service
      app: b-service
</code></pre>
<p>I want the monitor watches both <code>a-service</code> and <code>b-service</code>. The last above doesn't work because I defined duplicated key. I am wondering how should I change it to?</p>
<p>Thanks!</p>

kevin
<p>You can use <code>matchExpressions</code></p>
<pre><code>...
selector:
  matchExpressions:
    - {key: app, operator: In, values: [a-service,b-service]}

</code></pre>
