Skip to content

Instantly share code, notes, and snippets.

@verhovensky
Created October 7, 2025 21:31
Show Gist options
  • Select an option

  • Save verhovensky/1696fd9c052498d20dea4d5eff846f03 to your computer and use it in GitHub Desktop.

Select an option

Save verhovensky/1696fd9c052498d20dea4d5eff846f03 to your computer and use it in GitHub Desktop.
simple-deployment-3-autoscaling.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-web-deployment-autoscaling
labels:
app: my-k8s-application
env: prod
owner: StepanVerhovensky
spec:
replicas: 2
selector:
matchLabels:
project: mossad
template:
metadata:
labels:
project: mossad
spec:
containers:
- name: mossad-web
image: verhovenskybh/phpexample1:version2
ports:
- containerPort: 80
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: my-autoscaler
spec:
scaleTargetRef:
apiVersion: apps/v2
kind: Deployment
name: my-web-deployment-autoscaling
minReplicas: 2
maxReplicas: 6
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment