# Excluding a namespace or workload from the Automation with CRD

In some cases, you might want to exclude specific namespaces or workloads from automation. Use the following configurations in order to **exclude** the particular **namespace** or **workload** from automation in the cluster

## **Exclude a namespace**

```yaml
apiVersion: perfectscale.io/v1
kind: NamespaceAutomationConfig
metadata:
  name: your-namespace-automation-config
  namespace: your-namespace # The namespace where the configuration should be applied
spec:
  automation:
    operational:
      automationMode: Disabled # Disables Automation for the specified namespace
```

### Exclude kube-system namespace

By default, PerfectScale does not automate the `kube-system` namespace. However, in some cases, GCP users may encounter warning banners. If you notice this warning and want to prevent PerfectScale from intercepting the pods in this namespace (meaning you don't want to automate the kube-system namespace at all), further configuration is needed.

There are two ways to exclude the kube-system namespace completely:

1. Set `excludeNamespaces` to `kube-system` [here](https://github.com/perfectscale-io/perfectscale-io.github.io/blob/f39759c64cb64b357f05e4ac314f963f6cd1d61a/charts/psc-autoscaler/values.yaml#L22).

```
excludedNamespaces: ["kube-system"]
```

2. Upgrade the Automation Agent by running the following command:

```
helm upgrade --install -n perfectscale psc-autoscaler \
--set secret.create=false \
--reset-then-reuse-values \
--set "settings.excludedNamespaces[0]=kube-system" \
perfectscale/psc-autoscaler
```

## **Exclude a workload**

{% hint style="info" %}
Workload automation config should specify a namespace, and it should match the namespace of the associated workload.
{% endhint %}

```yaml
apiVersion: perfectscale.io/v1
kind: WorkloadAutomationConfig
metadata:
  name: your-workload-automation-config
  namespace: your-namespace # The namespace where the configuration should be applied
spec:
  automation:
    operational:
      automationMode: Disabled # Disables Automation for the workload with the specified parameters
  targetRef:
    kind: Deployment
    name: deployment-name-here
```

### **Exclude workload(s) by label**

{% hint style="info" %}
Workload automation config should specify a namespace, and it should match the namespace of the associated workload.
{% endhint %}

```yaml
apiVersion: perfectscale.io/v1
kind: NamespaceAutomationConfig
metadata:
  name: your-workload-automation-config
  namespace: your-namespace # The namespace where the configuration should be applied
spec:
  automation:
    operational:
      workloadLabelSelectors:
        - key: "environment"
          value: "production"
          allowAutomation: false    # Disables Automation for the workload(s) with the specified label
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.perfectscale.io/enable-automation/configuring-automation-with-crd/excluding-a-namespace-or-workload-from-the-automation-with-crd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
