Created
February 16, 2026 15:55
-
-
Save janakiramm/ecdf562770bcda97116aa315d4bae414 to your computer and use it in GitHub Desktop.
VPA Tutorial: Kubernetes YAML Manifests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: nginx-vpa-demo | |
| namespace: vpa-demo | |
| spec: | |
| replicas: 2 | |
| selector: | |
| matchLabels: | |
| app: nginx-vpa-demo | |
| template: | |
| metadata: | |
| labels: | |
| app: nginx-vpa-demo | |
| spec: | |
| containers: | |
| - name: nginx | |
| image: nginx:1.25 | |
| resources: | |
| requests: | |
| cpu: "50m" | |
| memory: "64Mi" | |
| limits: | |
| cpu: "200m" | |
| memory: "256Mi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Namespace | |
| metadata: | |
| name: vpa-demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: nginx-vpa-demo | |
| namespace: vpa-demo | |
| spec: | |
| selector: | |
| app: nginx-vpa-demo | |
| ports: | |
| - port: 80 | |
| targetPort: 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: autoscaling.k8s.io/v1 | |
| kind: VerticalPodAutoscaler | |
| metadata: | |
| name: nginx-vpa | |
| namespace: vpa-demo | |
| spec: | |
| targetRef: | |
| apiVersion: "apps/v1" | |
| kind: Deployment | |
| name: nginx-vpa-demo | |
| updatePolicy: | |
| updateMode: "InPlaceOrRecreate" | |
| resourcePolicy: | |
| containerPolicies: | |
| - containerName: "nginx" | |
| minAllowed: | |
| cpu: "25m" | |
| memory: "32Mi" | |
| maxAllowed: | |
| cpu: "1" | |
| memory: "512Mi" | |
| controlledResources: ["cpu", "memory"] | |
| controlledValues: "RequestsAndLimits" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: load-generator | |
| namespace: vpa-demo | |
| spec: | |
| containers: | |
| - name: busybox | |
| image: busybox:1.36 | |
| command: | |
| - /bin/sh | |
| - -c | |
| - | | |
| echo "Starting load generator..." | |
| while true; do | |
| wget -q -O- http://nginx-vpa-demo.vpa-demo.svc.cluster.local > /dev/null 2>&1 | |
| done | |
| restartPolicy: Always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: autoscaling.k8s.io/v1 | |
| kind: VerticalPodAutoscaler | |
| metadata: | |
| name: nginx-vpa | |
| namespace: vpa-demo | |
| spec: | |
| targetRef: | |
| apiVersion: "apps/v1" | |
| kind: Deployment | |
| name: nginx-vpa-demo | |
| updatePolicy: | |
| updateMode: "Off" | |
| resourcePolicy: | |
| containerPolicies: | |
| - containerName: "nginx" | |
| minAllowed: | |
| cpu: "25m" | |
| memory: "32Mi" | |
| maxAllowed: | |
| cpu: "1" | |
| memory: "512Mi" | |
| controlledResources: ["cpu", "memory"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment