Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Sysbench Example #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,24 @@ This project is inspired from [CLEVER](https://github.com/sustainable-computing-
```

### Updating Recommendations with Kruize VPA Recommender:
Define a VPA Custom Resource with the following configuration for the deployment you want to auto update
Deploy the example application that selects the Kruize recommender for VPA.
```commandline
kubectl apply -f examples/sysbench.yaml
```
The example YAML also defines a VPA Custom Resource with the following configuration to auto update

```commandline
apiVersion: "autoscaling.k8s.io/v1"
kind: VerticalPodAutoscaler
metadata:
name: tfb-vpa #vpa-name here
name: sysbench-vpa
spec:
recommenders:
- name: kruize
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: tfb-qrh-sample #deployment name here
name: sysbench
resourcePolicy:
containerPolicies:
- containerName: '*'
Expand All @@ -73,19 +77,21 @@ Kruize VPA will monitor all deployments that have the VPA custom resource define
You can also check the logs for the recommendations generated by Kruize VPA to understand the adjustments being made:

```commandline
$ oc logs -n kube-system kruize-vpa-86d6f97f76-j8mcm

$ oc logs -n kube-system kruize-vpa-5497f6f7cb-wh78s
Kruize URL: http://kruize-openshift-tuning.apps.vpatest.lab.psi.pnq2.redhat.com
VerticalPodAutoscaler CRD is present!
VPA tfb-vpa has chosen kruize recommender.
Selected VPA tfb-vpa in namespace default and deployment tfb-qrh-sample.
VPA sysbench-vpa has chosen kruize recommender.
Selected VPA sysbench-vpa in namespace default and deployment sysbench.
Generating recommendations -
http://kruize-openshift-tuning.apps.vpatest.lab.psi.pnq2.redhat.com/listExperiments?experiment_name=sysbench-vpa
Experiment for VPA exists.
http://kruize-openshift-tuning.apps.vpatest.lab.psi.pnq2.redhat.com/generateRecommendations?experiment_name=sysbench-vpa
Fetched latest recommendations.
Selected containers to update -
[{'container_image_name': 'kruize/tfb-qrh:1.13.2.F_et17', 'container_name': 'tfb-server'}]
CPU Recommendations: 0.2879953244444444
Memory Recommendations: 226993766.4
[{'containerName': 'tfb-server', 'lowerBound': {'cpu': '287m', 'memory': '216Mi'}, 'target': {'cpu': '287m', 'memory': '216Mi'}, 'upperBound': {'cpu': '287m', 'memory': '216Mi'}}]
[{'container_image_name': 'quay.io/rh-ee-shesaxen/sysbench', 'container_name': 'sysbench'}]
CPU Recommendations: 0.3428931864151752
Memory Recommendations: 3307929.6
[{'containerName': 'sysbench', 'lowerBound': {'cpu': '342m', 'memory': '3Mi'}, 'target': {'cpu': '342m', 'memory': '3Mi'}, 'upperBound': {'cpu': '342m', 'memory': '3Mi'}}]
Patching vpa object with available recommendations.
VPA has been patched to apply recommendations.
Sleeping for 60 seconds ...
Expand Down
49 changes: 49 additions & 0 deletions examples/sysbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: "autoscaling.k8s.io/v1"
kind: VerticalPodAutoscaler
metadata:
name: sysbench-vpa
spec:
recommenders:
- name: kruize
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: sysbench
resourcePolicy:
containerPolicies:
- containerName: '*'
controlledResources: ["cpu", "memory"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sysbench
spec:
selector:
matchLabels:
app: sysbench
replicas: 2
template:
metadata:
labels:
app: sysbench
spec:
securityContext:
runAsNonRoot: true
runAsUser: 65534 # nobody
containers:
- name: sysbench
image: quay.io/rh-ee-shesaxen/sysbench
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 250m
memory: 500Mi
command:
- sysbench
- cpu
- --threads=1
- --time=100000
- run