🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)

🔧 Programmierung 🕛 vor 1 Monat 3 Min Lesezeit
0

Kubernetes HPA: Guide with Apache on KIND

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

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






CODE
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






CODE
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






CODE
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






CODE
@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






CODE
# 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.




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












7. Monitor Autoscaling



Watch the HPA status in real time.




CODE
kubectl get hpa -w






Watch Pods being created or terminated.




CODE
kubectl get pods -w






Check CPU utilization of each Pod.




CODE
kubectl top pods












HPA Workflow






CODE
                 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.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Burn Out, Or Fade Away
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
Ä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 ...