How to manage multiple namespaces with a single elastic operator

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: elastic-operator
but the pods are not even coming up.
I have even enabled the --cluster-roles = --all
Answer would be really appreciated.

Is there any one who can help me on this?

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 ?

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

Yes, something along those lines:

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

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?

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 ?

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?

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

Let me know if the documentation helps you.

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

--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)

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.