# Issue with service account role binding

**URL:** <https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [July 3, 2020, 8:56pm UTC](https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857 "2020-07-03T20:56:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lilth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lilth/32/46835_2.png) [@Lilth](https://discuss.elastic.co/u/Lilth)\
**Post date:** [July 3, 2020, 8:56pm UTC](https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857/1 "2020-07-03T20:56:27Z")

</div>

Hello,

I have recently faced an issue with OpenShift service account access to ElasticSearch.

I can access ElasticSearch only if a service account is mapped to the cluster-admin role.

Idea is to create a new service account with access to pod/logs and set role/permissions without binding it to the cluster-admin role. Local admin is not working as well. I wonder which set of verbs and role binding do I need to use.

Did anyone face a similar issue? Any advice is welcome.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [July 8, 2020, 9:35am UTC](https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857/2 "2020-07-08T09:35:21Z")

</div>

Hey @Lilth,

> OpenShift service account access to Elasticsearch

Can you clarify what you mean by "access to Elasticsearch"?

- the Elasticsearch HTTP API (`curl http://<url>:9200`)?
- the Elasticsearch resource (`kubectl get elasticsearch`)?
- the Elasticsearch pod (`kubectl get pod <es-pod>`)?

In general you can create your own (Cluster)Role and (Cluster)RoleBinding by following Openshift and/or Kubernetes documentation.

You probably want a role to access the `Elasticsearch` resource:

```yaml
- apiGroups:
  - elasticsearch.k8s.elastic.co
  resources:
  - elasticsearches
  - elasticsearches/status
  - elasticsearches/finalizers
  - enterpriselicenses
  - enterpriselicenses/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete

```

And similar ones for the `pods` resource and its `log` subresource.

---

<div class="post-metadata">

**Author:** ![Lilth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lilth/32/46835_2.png) [@Lilth](https://discuss.elastic.co/u/Lilth)\
**Post date:** [July 9, 2020, 6:47am UTC](https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857/3 "2020-07-09T06:47:42Z")

</div>

Hello @sebgl

Thank you for your reply!

Issue is fixed. I created new cluster role with get/list to pod and pod/logs.  
After it, it was binded to local admin (sa) in project.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 8:05am UTC](https://discuss.elastic.co/t/issue-with-service-account-role-binding/239857/4 "2022-11-04T08:05:01Z")

</div>


