Added cpu-load-test appliation

To show metrics-transfer trigger from sno to acm hub cluster.
This commit is contained in:
Andreas
2024-01-12 17:03:45 +13:00
committed by James Blair
parent 18158f57df
commit c76a3b2f60

View File

@ -338,3 +338,51 @@ oc get secret sno-import -n sno -o jsonpath={.data.import\\.yaml} | base64 --dec
oc --kubeconfig sno/auth/kubeconfig apply --filename klusterlet-crd.yaml
oc --kubeconfig sno/auth/kubeconfig apply --filename import.yaml
#+end_src
If everything works fine you should see JOINED and AVAILABLE sno cluster from within your hub cluster
#+begin_src tmux
kubectl get managedcluster -n sno
NAME HUB ACCEPTED MANAGED CLUSTER URLS JOINED AVAILABLE AGE
local-cluster true https://api.hub.<yourdomain>.com:6443 True True 5h12m
sno true https://api.cluster-vzmvz.<yourdomain>.com:6443 True True 31m
#+end_src
* 7 - Creating the edge workload on SNO
For edge scenarios we only send metrics to the hub cluster if certain thresholds are hit for a certain period of time (here 70% for more than 2 minutes - you can see this configuration in the open-cluster-management-addon-observability namespace under ConfigMaps observability-metrics-allowlist in the collect_rules section under SNOHighCPUUsage).
In order to hit that trigger we now deploy a cpu-heavy workload in order for sno-cluster metrics being sent to the ACM hub cluster.
Let's get started by creating a new project on the sno cluster:
#+begin_src tmux
oc new-project cpu-load-test
#+end_src
and deploy the cpu-load-container workload on a busybox container
#+begin_src tmux
cat << EOF | oc apply --filename -
apiVersion: apps/v1
kind: Deployment
metadata:
name: cpu-load-test
spec:
replicas: 5
selector:
matchLabels:
app: cpu-load-test
template:
metadata:
labels:
app: cpu-load-test
spec:
containers:
- name: cpu-load-container
image: busybox
command: ["/bin/sh", "-c"]
args:
- while true; do
echo "Performing CPU load...";
dd if=/dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 1000 | head -n 1000000 > /dev/null;
done
EOF
#+end_src