# Namespaced ray operator has not enough permission

**URL:** <https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866>\
**Category:** Ray Clusters\
**Created:** [April 20, 2022, 9:07am UTC](https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866 "2022-04-20T09:07:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![soloman817](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/soloman817/32/1641_2.png) [@soloman817](https://discuss.ray.io/u/soloman817)\
**Post date:** [April 20, 2022, 9:07am UTC](https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866/1 "2022-04-20T09:07:53Z")

</div>

I use helm to generate a namespaced ray operator and deployed to kubernetes (with ray 1.12.0)

But I always got this:

```auto
Not enough permissions to watch for resources: changes (creation/deletion/updates) will not be noticed; the resources are only refreshed on operator restarts.
Not enough permissions to list namespaces. Falling back to a list of namespaces which are assumed to exist: {'ray-test'}
Not enough permissions to watch for namespaces: changes (deletion/creation) will not be noticed; the namespaces are only refreshed on operator restarts.

```

Any one knows what permission I shall give? Isn’t the permissions in the heml not enough?

```auto
# Source: ray/templates/operator_namespaced.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: ray-operator-serviceaccount
  namespace: ray-test
---
# Source: ray/templates/operator_namespaced.yaml
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: ray-operator-role
  namespace: ray-test
rules:
- apiGroups: ["", "cluster.ray.io"]
  resources: ["rayclusters", "rayclusters/finalizers", "rayclusters/status", "pods", "pods/exec", "services"]
  verbs: ["get", "watch", "list", "create", "delete", "patch", "update"]
- apiGroups: [""]
  resources: [events]
  verbs: [create]
---
# Source: ray/templates/operator_namespaced.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: ray-operator-rolebinding
  namespace: ray-test
subjects:
- kind: ServiceAccount
  name: ray-operator-serviceaccount
  namespace: ray-test
roleRef:
  kind: Role
  name: ray-operator-role
  apiGroup: rbac.authorization.k8s.io
---
# Source: ray/templates/operator_namespaced.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ray-operator
  namespace: ray-test
spec:
  replicas: 1
  selector:
    matchLabels:
      cluster.ray.io/component: operator
  template:
    metadata:
      labels:
        cluster.ray.io/component: operator
    spec:
      serviceAccountName: ray-operator-serviceaccount
      containers:
      - name: ray
        imagePullPolicy: Always
        image: rayproject/ray:1.12.0
        command: ["ray-operator"]
        env:
        - name: RAY_OPERATOR_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: AUTOSCALER_MAX_NUM_FAILURES
          value: "inf"
        resources:
          requests:
            cpu: 1
            memory: 1Gi
            ephemeral-storage: 1Gi
          limits:
            memory: 2Gi
            cpu: 1

```

---

<div class="post-metadata">

**Author:** ![soloman817](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/soloman817/32/1641_2.png) [@soloman817](https://discuss.ray.io/u/soloman817)\
**Post date:** [April 20, 2022, 9:39am UTC](https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866/2 "2022-04-20T09:39:47Z")

</div>

Ok, it turns out the user in the pod is not `ray` because of some k8s cluster policy. Changed to `ray` then it works.

---

<div class="post-metadata">

**Author:** ![Ameer\_Haj\_Ali](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/ameer_haj_ali/32/279_2.png) [@Ameer\_Haj\_Ali](https://discuss.ray.io/u/Ameer_Haj_Ali)\
**Post date:** [April 25, 2022, 11:46am UTC](https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866/3 "2022-04-25T11:46:46Z")

</div>

Thanks @soloman817 , please let us know if you still need any help.

---

<div class="post-metadata">

**Author:** ![soloman817](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/soloman817/32/1641_2.png) [@soloman817](https://discuss.ray.io/u/soloman817)\
**Post date:** [April 25, 2022, 11:59am UTC](https://discuss.ray.io/t/namespaced-ray-operator-has-not-enough-permission/5866/4 "2022-04-25T11:59:17Z")

</div>

Thanks, it works and the reason is the user should be `ray` . But the logging is a bit misleading. I can understand it has no namespace permission (because I’m deploying a namespaced operator), but the other two logs are a little bit misleading.
