Prompt

How do I configure autoscaling for containers in Kubernetes?

Technology / Cloud Infrastructure1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

To configure autoscaling for containers in Kubernetes, you typically use Horizontal Pod Autoscaler (HPA), which automatically increases or decreases the number of pod replicas based on metrics like CPU or memory usage.

1) Prerequisites

  • Your cluster must have:
    • Metrics Server installed for basic CPU/memory autoscaling.
    • A workload managed by a Deployment, StatefulSet, or similar controller.
  • Your containers should define resource requests for CPU/memory, otherwise HPA has nothing reliable to scale from.

Example resource requests:

resources:
  requests:
    cpu: "100m"
    memory: "128Mi"
  limits:
    cpu: "500m"
    memory: "256Mi"

2) Create a deployment

Example nginx-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.25
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "256Mi"

Apply it:

kubectl apply -f nginx-deployment.yaml

3) Create an HPA

Example scaling based on CPU utilization:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: nginx-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: nginx
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 50

Apply it:

kubectl apply -f nginx-hpa.yaml

This means:

  • keep at least 2 pods
  • scale up to 10 pods
  • try to keep average CPU usage around 50% of requested CPU

4) Verify it

Check HPA status:

kubectl get hpa
kubectl describe hpa nginx-hpa

Check deployment replicas:

kubectl get deploy nginx

5) Install Metrics Server if needed

If kubectl get hpa shows no metrics, install Metrics Server.

Typical install:

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

Depending on your environment, you may need extra flags, especially for self-signed certificates or certain cloud/on-prem clusters.


6) Optional: autoscale on custom metrics

You can also scale based on:

  • memory usage
  • request rate
  • queue length
  • custom application metrics

For that, you usually need:

  • Custom Metrics API or External Metrics API
  • an adapter like Prometheus Adapter or cloud-provider integration

Example memory-based HPA:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: nginx-memory-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: nginx
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 60

7) Other types of autoscaling

  • HPA: scales pod replicas horizontally
  • VPA (Vertical Pod Autoscaler): adjusts CPU/memory requests/limits
  • Cluster Autoscaler: adds/removes nodes when pods can’t be scheduled

These are often used together:

  • HPA for pod count
  • Cluster Autoscaler for node count

Common pitfalls

  • Missing resource requests
  • Metrics Server not working
  • Trying to autoscale a workload that isn’t managed by a scalable controller
  • Setting min/max replicas too tightly
  • Scaling based on limits instead of requests

If you want, I can give you:

  1. a ready-to-apply YAML example,
  2. an example using CPU + memory, or
  3. an example using Prometheus/custom metrics.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.