Simplified and Cost-Efficient GKE Node Management with NAP:
Secure your spot!
LogoLogo
PerfectScale.ioStart for FreeYour Account
  • Kubernetes Optimization
  • Getting started
    • How to onboard a cluster
    • Onboarding clusters programmatically
    • Onboarding with ArgoCD
    • Updating PerfectScale Agent resources
    • Re-onboarding a cluster
  • Enable automation
    • Automation setup instruction
    • Including a cluster, namespace or workload to the Automation
      • Configuring Automation for a cluster
      • Configuring Automation for a namespace
      • Configuring Automation for a workload
    • Excluding a namespace or workload from the Automation
    • Automation customization
    • Verifying Automation status
    • Exploring Automation KPIs
    • Self-healing mechanism for unschedulable pods
    • Disable automation
    • Troubleshooting
    • Automation with GitOps
  • Cloud billing integration
    • Connecting AWS CUR
    • Connecting Azure Cost Management
  • Clusters' metrics overview
  • Podfit | vertical pod right-sizing
    • Understanding 'At Risk' indicators
    • LimitRange and ResourceQuota
  • Infrafit | node right-sizing
  • Configure alerts
    • Alerts acknowledgement
  • Trends monitoring
  • Revisions history log
  • Product overview
    • How to monitor PerfectScale Agent
    • PerfectScale data collected
    • PerfectScale Autoscaler Objects' Events
    • Outbound Request Ports used by the Exporter and Autoscaler
    • PerfectScale Weekly Report
    • Product architecture
  • Customizations
    • Alerting
      • Resiliency alerts
      • Financial alerts
    • Pricing
      • Custom Pricing configuration
      • AWS CUR configuration
      • Azure Cost Management configuration
    • Ticketing & Bug Tracking
    • Communication & Messaging
      • Slack Integration
        • How to configure slack_token
        • How to configure routings
      • MS Teams Integration
        • How to configure teams_webhook
      • Datadog Alerts Integration
    • Label customizations
    • Grouping
    • Observability
    • Podfit labels
    • Optimization Policy customization
  • Administration
    • Cluster settings
    • User management
    • Roles and permissions
    • Subscription details
    • Help Center
  • PerfectScale trial
    • How to find your allocated vCPU?
  • PerfectScale Prometheus Exporter
  • Security
    • MFA
    • SSO
    • ps-agent RBAC Permissions
    • psc-autoscaler RBAC Permissions
    • ps-exporter via Proxy Configuration
  • Public API
  • Help PerfectScale to improve
  • Go to your account
Powered by GitBook
LogoLogo

© PerfectScale 2025

On this page
  • Including a namespace to the Automation
  • Automating multiple namespaces with a single configuration
  • Automating kube-system namespace
  1. Enable automation
  2. Including a cluster, namespace or workload to the Automation

Configuring Automation for a namespace

Learn how to apply Automation to all workloads within the namespace effortlessly

Including a namespace to the Automation

The following example of a namespace-level automation configuration allows you to customize automation settings for specific namespaces, catering to the needs of different applications. This example shows how to automate optimization for all Deployment-type workloads in the namespace.

Create a YAML file with the namespace-level automation configuration using the following template:

apiVersion: perfectscale.io/v1
kind: NamespaceAutomationConfig
metadata:
  name: namespace-automation-config
  namespace: your-namespace # The namespace where the configuration should be applied
spec:
  automation:
    operational:
        automationMode: "Enabled" # Enables automation for a specific namespace
        timeConstraints:
          wasteMaxAutomationFrequency: "30m" # Applies recommendations to decrease resources every 30 minutes
          fixResiliencyMaxAutomationFrequency: "30m" # Applies recommendations to increase resources every 30 minutes
          maintenanceWindow:
            monday:
              - "00:00-23:59"
            tuesday:
              - "00:00-23:59"
            wednesday:
              - "00:00-23:59"
            thursday:
              - "00:00-23:59"
            friday:
              - "00:00-23:59"
            saturday:
              - "00:00-23:59"
            sunday:
              - "00:00-23:59"
          maintenanceWindowIgnoredForResiliency: false # Indicates if the maintenance window constraints are ignored for resiliency
        restrictions:
          workloadMinWasteUSDPerMonth: 5 # Activates automation only if monthly waste exceeds a set threshold (for example, $5)
          cpuManagement:
            request:
              increaseEnabled: false # Doesn't allow PerfectScale Automation to increase CPU requests if the performance risks are observed
              decreaseEnabled: true # Allows PerfectScale Automation to decrease CPU requests to minimize waste
              minimumCores: -1 # If a recommendation falls below the value, the automation will implement the minimum instead
              maximumCores: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
            limit:
              keepLimit: true # Automation will maintain a non-zero CPU limit and will not set the value to zero
          memoryManagement:
            request:
              increaseEnabled: false # Doesn't allow PerfectScale Automation to increase Memory requests if the performance risks are observed
              decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory requests to minimize waste
              minimumGiB: -1 # If a recommendation falls below the value, the automation will implement the minimum instead
              maximumGiB: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
            limit:
              increaseEnabled: false # Doesn't allow PerfectScale Automation to increase Memory limit if the performance risks are observed
              decreaseEnabled: false # Doesn't allow PerfectScale Automation to decrease Memory limit
              minimumGiB: -1 # If a recommendation falls below the value, the automation will implement the minimum inst
              maximumGiB: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
              memoryLeakDetection:
                maxMemoryIncreaseIterations:
                  daily: 3 # Allows automation to increase memory limit up to 3 times per day
                  weekly: 6 # Allows automation to increase memory limit up to 6 times per week
    workloadTypes:
      Deployment:
        operational:
          automationMode: "Enabled" # Enables automation for the workloads with a specific type in the cluster/namespace
          timeConstraints:
            wasteMaxAutomationFrequency: "30m" # Applies recommendations to decrease resources every 30 minutes
            fixResiliencyMaxAutomationFrequency: "30m" # Applies recommendations to increase resources every 30 minutes
            maintenanceWindow:
              monday:
                - "00:00-23:59"
              tuesday:
                - "00:00-23:59"
              wednesday:
                - "00:00-23:59"
              thursday:
                - "00:00-23:59"
              friday:
                - "00:00-23:59"
              saturday:
                - "00:00-23:59"
              sunday:
                - "00:00-23:59"
            maintenanceWindowIgnoredForResiliency: false # Indicates if the maintenance window constraints are ignored for resiliency
          restrictions:
            workloadMinWasteUSDPerMonth: 5 # Activates automation only if monthly waste exceeds a set threshold (for example, $5)
            cpuManagement:
              request:
                increaseEnabled: false # Doesn't allow PerfectScale Automation to increase CPU requests if the performance risks are observed
                decreaseEnabled: true # Allows PerfectScale Automation to decrease CPU requests to minimize waste
                minimumCores: -1 # If a recommendation falls below the value, the automation will implement the minimum instead
                maximumCores: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
              limit:
                keepLimit: true # Automation will maintain a non-zero CPU limit and will not set the value to zero
            memoryManagement:
              request:
                increaseEnabled: false # Doesn't allow PerfectScale Automation to increase Memory requests if the performance risks are observed
                decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory requests to minimize waste
                minimumGiB: -1 # If a recommendation falls below the value, the automation will implement the minimum instead
                maximumGiB: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
              limit:
                increaseEnabled: false # Doesn't allow PerfectScale Automation to increase Memory limit if the performance risks are observed
                decreaseEnabled: false # Doesn't allow PerfectScale Automation to decrease Memory limit
                minimumGiB: -1 # If a recommendation falls below the value, the automation will implement the minimum instead
                maximumGiB: -1 # If a recommendation falls above the value, the automation will implement the maximum instead
                memoryLeakDetection:
                  maxMemoryIncreaseIterations:
                    daily: 3 # Allows automation to increase memory limit up to 3 times per day
                    weekly: 6 # Allows automation to increase memory limit up to 6 times per week 

Apply the created configuration by running the following command (where namespace-automation-config.yaml - the name of your file created in the previous step)

kubectl apply -f namespace-automation-config.yaml

Automating multiple namespaces with a single configuration

If you want to apply the same configuration to multiple namespaces, remove namespace: your-namespace from the configuration and apply the configuration with the following command for each namespace kubectl apply -f namespace-automation-config.yaml -n namespace, where namespace - the namespace where it will be applied. If a namespace is specified neither in the configuration nor in the command, the configuration will be applied to the default namespace.

Automating kube-system namespace

By default, PerfectScale does not automate the kube-system namespace. To enable automation for this namespace, follow these simple steps.

Remove the kube-system namespace from the excludedNamespaces (is only needed if you are using Autoscaler v1.0.6 and older).

helm upgrade --install -n perfectscale --reset-then-reuse-values psc-autoscaler --set settings.excludedNamespaces=[] ./helm

Create a YAML file with the namespace-level automation configuration using the following template:

apiVersion: perfectscale.io/v1
kind: NamespaceAutomationConfig
metadata:
  name: kube-system-ns-config
  namespace: kube-system # The namespace where the configuration should be applied
spec:
  automation:
    operational:
      automationMode: "Enabled" # Enables automation for a specific namespace
      restrictions:
        workloadMinWasteUSDPerMonth: 5 # Activates automation only if monthly waste exceeds a set threshold (for example, $5)
        cpuManagement:
          request:
            increaseEnabled: true # Allows PerfectScale Automation to increase CPU requests if the performance risks are observed
            decreaseEnabled: true # Allows PerfectScale Automation to decrease CPU requests to minimize waste
          limit:
            keepLimit: false # Automation can set the CPU limit to zero
        memoryManagement:
          request:
            increaseEnabled: true # Allows PerfectScale Automation to increase Memory requests if the performance risks are observed
            decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory requests to minimize waste
          limit:
            increaseEnabled: true # Allows PerfectScale Automation to increase Memory limit if the performance risks are observed
            decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory limit

Apply the created configuration by running the following command (where kube-system-ns-config.yaml - the name of your file created in the previous step)

kubectl apply -f kube-system-ns-config.yaml
helm upgrade --install -n perfectscale psc-autoscaler \
      --set-string admission.annotations."admissions\.enforcer/disabled"=true \
      perfectscale/psc-autoscaler
PreviousConfiguring Automation for a clusterNextConfiguring Automation for a workload

Last updated 23 days ago

If you need to automate the kube-system namespace in an AKS cluster, additional configuration is required . Learn more about the configuration .

Explore more about automation customization options .

Automating kube-system namespace in AKS clusters

Azure Kubernetes Service has a that prevents tools from managing resources within the kube-system namespace by default. To enable automation in this namespace, it is necessary to add the following annotation to allow Admissions Enforcer to ignore it:

❗
here
known limitation
due to known limitations
here