apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cart-discovery
rules:
  - apiGroups: [""] # "" indicates the core API group
    resources: ["pods","services", "deployments"]
    verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: cart-discovery-binding
subjects:
- kind: ServiceAccount
  name: default
  namespace: cart
  apiGroup: ""
roleRef:
  kind: ClusterRole
  name: cart-discovery
  apiGroup: ""