Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Kubernetes HPA: Guide with Apache on KIND

Horizontal Pod Autoscaler (HPA) automatically increases or decreases the number of Pods based on CPU or memory utilization. In this project, I configured HPA on a local KIND cluster and verified autoscaling using CPU-based metrics. …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Horizontal Pod Autoscaler (HPA) automatically increases or decreases the number of Pods based on CPU or memory utilization. In this project, I configured HPA on a local KIND cluster and verified autoscaling using CPU-based metrics.









1. Namespace



A Namespace logically separates Kubernetes resources, making it easier to organize and manage applications independently.






namespace.yml






kind: Namespace
apiVersion: v1
metadata:
name: apache












2. Deployment



The Deployment manages the desired number of application Pods. I configured CPU requests and limits because HPA uses these values to calculate resource utilization and make scaling decisions.






deployment.yml






apiVersion: apps/v1
kind: Deployment

metadata:
name: apache-deployment
namespace: apache

spec:
replicas: 3

selector:
matchLabels:
app: apache-app

template:
metadata:
labels:
app: apache-app

spec:
containers:
- name: apache

image: httpd:latest

imagePullPolicy: Always

ports:
- containerPort: 80

resources:
requests:
cpu: "100m"
memory: "100Mi"

limits:
cpu: "200m"
memory: "250Mi"












3. Service



A Service provides a stable endpoint for accessing the application and distributes incoming traffic across all available Pods.






service.yml






apiVersion: v1
kind: Service
metadata:
name: apache-sv
namespace: apache
spec:
selector:
app: apache-app
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP












4. Metrics Server



Metrics Server collects CPU and memory usage from each Pod and exposes these metrics to Kubernetes. Without Metrics Server, HPA cannot monitor resource utilization.






Verify Metrics Server






@root-IdeaPad-Gaming-3-15IHU6:~/Code/K8s/django_hpa$ kubectl top nodes -n apache
NAME CPU(cores) CPU(%) MEMORY(bytes) MEMORY(%)
demo-kind-cluster-control-plane 126m 1% 612Mi 7%
demo-kind-cluster-worker 29m 0% 487Mi 6%
demo-kind-cluster-worker2 27m 0% 471Mi 6%
demo-kind-cluster-worker3 34m 0% 520Mi 6%
@root-IdeaPad-Gaming-3-15IHU6:~/Code/K8s/django_hpa$ kubectl top pods -n apache
NAME CPU(cores) MEMORY(bytes)
apache-deployment-67856f954c-b4n2x 1m 13Mi
apache-deployment-67856f954c-xkmwb 1m 12Mi






If CPU and memory metrics are displayed, the Metrics Server is working correctly.









5. Horizontal Pod Autoscaler (HPA)



The Horizontal Pod Autoscaler continuously monitors CPU utilization and automatically increases or decreases the number of Pod replicas based on the configured target utilization.






hpa.yml






# Horizontal Pod Autoscaler for Django Todo Application
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: apache-hpa
namespace: apache
spec:
# Target the Apache deployment
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apache-deployment

# Scaling limits
minReplicas: 2
maxReplicas: 10

# Metrics to scale on
metrics:
# CPU-based scaling
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50

# Memory-based scaling
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 70

# Scaling behavior configuration
behavior:
# Scale down policies
scaleDown:
stabilizationWindowSeconds: 30
policies:
- type: Percent
value: 50
periodSeconds: 15
- type: Pods
value: 2
periodSeconds: 15
selectPolicy: Min

# Scale up policies
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max












6. Generate Load



Generate continuous HTTP requests to simulate client traffic and trigger autoscaling.




while true; do curl -s http://localhost:8000 > /dev/null; done












7. Monitor Autoscaling



Watch the HPA status in real time.




kubectl get hpa -w






Watch Pods being created or terminated.




kubectl get pods -w






Check CPU utilization of each Pod.




kubectl top pods












HPA Workflow






                 Client Requests
│
▼
Kubernetes Service
│
▼
Deployment
│
▼
Application Pods
│
▼
Metrics Server
│
▼
Horizontal Pod Autoscaler
│
▼
Scale Pods Up or Scale Pods Down












Key Learnings




  • HPA automatically scales Pods based on CPU or Memory utilization.

  • Metrics Server is mandatory for CPU-based autoscaling.

  • CPU requests must be defined in the Deployment.


  • kubectl top pods helps monitor real-time resource usage.

  • HPA improves application scalability without manual intervention.









Conclusion



Horizontal Pod Autoscaler makes Kubernetes applications more resilient by automatically adjusting the number of running Pods according to workload demand. This hands-on implementation on a KIND cluster helped me understand the complete autoscaling workflow—from collecting metrics to dynamically scaling application replicas.

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Kubernetes HPA: Guide with Apache on KIND
id: 5294a88c-7556-462f-8da5-76139cc6a3a7
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "Kubernetes HPA: Guide with Apa" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Kubernetes HPA Guide with Apache on KIND")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*Kubernetes HPA Guide with Apache on KIND*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Kubernetes HPA Guide with Apache on KIND"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Kubernetes HPA: Guide with Apache on KIN.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Kubernetes HPA: Guide with Apache on KIND

Thematisch verwandte Begriffe: Kubernetes, Guide, with, Apache · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-88003 | InvoicePlane is a self-hosted open source application for managing invoi…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag