# How to manage multiple namespaces with a single elastic operator

**URL:** <https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [September 28, 2020, 1:11pm UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188 "2020-09-28T13:11:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 28, 2020, 1:11pm UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/1 "2020-09-28T13:11:58Z")

</div>

Hi,  
I have deployed elastic operator from the quickstart documentation. I have deployed elasticsearch, kibana from the same documentation under the namespace(elastic-system) where I have deployed the elastic operator. Now I am trying to deploy same elasticsearch in another namespace and I have annotated this with  
annotations:  
[operator.k8s.elastic.co/managed-by:](http://operator.k8s.elastic.co/managed-by:) elastic-operator  
but the pods are not even coming up.  
I have even enabled the --cluster-roles = --all  
Answer would be really appreciated.

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 29, 2020, 7:10am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/2 "2020-09-29T07:10:01Z")

</div>

Is there any one who can help me on this?

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [September 29, 2020, 8:02am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/3 "2020-09-29T08:02:16Z")

</div>

Hi,

There is no need to add an annotation. If you have followed the quickstart ECK should automatically watch all the namespaces in your cluster.

Could you try to create a resource just by changing the `namespace` attribute in the manifest or by using the `-n` option with kubectl ?

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 29, 2020, 8:34am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/4 "2020-09-29T08:34:25Z")

</div>

Here creating a resources means which resource? you mean elasticsearch?

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [September 29, 2020, 10:11am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/5 "2020-09-29T10:11:13Z")

</div>

Yes, something along those lines:

```auto
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
  namespace: my-namespace # set the namespace here
spec:
  version: 7.9.2
  nodeSets:
  - name: default
    count: 1
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
EOF

```

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 29, 2020, 10:13am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/6 "2020-09-29T10:13:45Z")

</div>

Yes, that I have tried but it is not even showing any pods.  
I will tell you clearly what I did, I have deployed an operator it got deployed under elastic-system namespace, In the same namespace I have deployed Elasticsearch, kibana. That is working fine.  
Now I want to deploy another instance of Elasticsearch, kibana in another namespace but I want this also has to be managed by the same oprerator which I have deployed under elastic-system namespace.  
So when I am trying this the pods are not even showing when I am using this command,  
kubectl get po -n \<namespace\_name\>.  
I think now you understand what I want?

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [September 29, 2020, 1:44pm UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/7 "2020-09-29T13:44:25Z")

</div>

I would need more information:

- Could you check if there is any error in the operator logs ?
- Also could you get the events in the target namespace to check if Pod creation is refused by an admission controller ?
- Could you copy/paste the manifest of the operator's statefulset in `elastic-system` to check which operator flags are actually set ?

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 29, 2020, 2:36pm UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/8 "2020-09-29T14:36:50Z")

</div>

Thanks for your response.

- I got issues because in operator sts I have mentioned one parameter like  
-arg:  
- namespaces: elastic-system

- So might be because of that I got those issues.

- can you give me some clarification on that namespace parameter like when I want to restrict access to few namespaces what I have to do? And some info on the operator behavious on this namespaces?

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [September 30, 2020, 7:31am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/9 "2020-09-30T07:31:26Z")

</div>

Operator's flags are described here: [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-operator-config.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-operator-config.html)

Let me know if the documentation helps you.

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [September 30, 2020, 7:57am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/10 "2020-09-30T07:57:57Z")

</div>

This I already have gone through, But that didn't help me....In the documentation they mentioned this

- Namespaces in which this operator should manage resources. Accepts multiple comma-separated values. Defaults to all namespaces if empty or unspecified.  
So from this when I want my operator to restrict access to only 2 namesapces can I use this flag

- --namespaces: namespace1,namespace2

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [October 1, 2020, 6:06am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/11 "2020-10-01T06:06:59Z")

</div>

> `--namespaces: namespace1,namespace2`

Not sure if it is a typo but it should be `--namespaces=namespace1,namespace2` _(note the equal sign instead of the colon character)_

---

<div class="post-metadata">

**Author:** ![Vineeth\_varma](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Vineeth\_varma](https://discuss.elastic.co/u/Vineeth_varma)\
**Post date:** [October 5, 2020, 9:12am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/14 "2020-10-05T09:12:56Z")

</div>

Hi @michael.morello,

With operator mode of deployment one of my Kibana pod it is not coming to 1/1 running state, error message when checking the logs

{"type":"log","@timestamp":"2020-10-05T09:07:27Z","tags":["warning","plugins-discovery"],"pid":8,"message":"Expect plugin "id" in camelCase, but found: beats\_management"}  
{"type":"log","@timestamp":"2020-10-05T09:07:27Z","tags":["warning","plugins-discovery"],"pid":8,"message":"Expect plugin "id" in camelCase, but found: triggers\_actions\_ui"}  
[BABEL] Note: The code generator has deoptimised the styling of /usr/share/kibana/x-pack/plugins/canvas/server/templates/pitch\_presentation.js as it exceeds the max of 500KB.

---

<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:14am UTC](https://discuss.elastic.co/t/how-to-manage-multiple-namespaces-with-a-single-elastic-operator/250188/15 "2022-11-04T08:14:09Z")

</div>


