# Monitor a specific namespace in GKE Environment.

**URL:** <https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544>\
**Category:** Container platforms\
**Tags:** kubernetes\
**Created:** [September 15, 2022, 8:09am UTC](https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544 "2022-09-15T08:09:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mayank\_Sh](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Mayank\_Sh](https://community.dynatrace.com/u/Mayank_Sh)\
**Post date:** [September 15, 2022, 8:09am UTC](https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544/1 "2022-09-15T08:09:31Z")

</div>

OneAgent monitors all the namespace including Dynatrace namespace where OneAgent is installed.

1). We are getting unwanted logs of oneAgent and other namespace containers and pods.  
2). We are unwanted monitoring the namespace and containers , pods , infrasture details etc.

**How to restrict oneAgent to monitored a specific namespace in dynakube.YAML**

---

<div class="post-metadata">

**Author:** ![Radoslaw\_Szulgo](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radoslaw_szulgo/32/1977_2.png) [@Radoslaw\_Szulgo](https://community.dynatrace.com/u/Radoslaw_Szulgo)\
**Post date:** [September 15, 2022, 12:33pm UTC](https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544/2 "2022-09-15T12:33:34Z")

</div>

By default, Dynatrace Operator injects OneAgent into all namespaces, with the following exceptions:

- Namespaces starting with&nbsp;`kube-`or&nbsp;`openshift-`.
- The namespace where Dynatrace Operator was installed.

There are more configuration options:

1. **Monitor all namespaces except selected pods.**
2. **Monitor only specific namespaces.**
  - If you don’t want Dynatrace Operator to inject OneAgent in all namespaces, you can set the&nbsp;`namespaceSelector`&nbsp;the parameter in the DynaKube custom resource, and enable monitoring for specific namespaces that have the chosen label.

3. **Exclude specific namespaces from being monitored.**
  - To enable this option, edit the DynaKube custom resource file.

Read more at:

> **[Guides](https://docs.dynatrace.com/docs/ingest-from/setup-on-k8s/guides)**
>
> Detailed description of installation and configuration options for specific use-cases

---

<div class="post-metadata">

**Author:** ![Mayank\_Sh](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Mayank\_Sh](https://community.dynatrace.com/u/Mayank_Sh)\
**Post date:** [September 16, 2022, 7:56am UTC](https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544/3 "2022-09-16T07:56:02Z")

</div>

![2.PNG](https://global.discourse-cdn.com/dynatrace/original/2X/a/ab40c64de0d18f234fd7ff6f93aa05767c625324.png)

command exexuted : **kubectl label namespace wa monitor=app**

**Dynakube YAML :**

namespaceSelector:  
matchLabels:  
monitor: app

But still the other namespace and other container logs are shown inside the kubernetes page.

---

<div class="post-metadata">

**Author:** ![MarcoCritti](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marcocritti/32/8974_2.png) [@MarcoCritti](https://community.dynatrace.com/u/MarcoCritti)\
**Post date:** [March 24, 2023, 11:01am UTC](https://community.dynatrace.com/t/monitor-a-specific-namespace-in-gke-environment/36544/4 "2023-03-24T11:01:51Z")

</div>

Hi Radoslaw

Does this also work for Classic full-stack installation?
