krkn-chaos / krkn-hub

Containerized wrapper around https://github.com/krkn-chaos/krkn to inject failures into Kubernetes clusters with minimal configuration.
Apache License 2.0
18 stars 18 forks source link

[ERROR] scenario: scenarios/pvc_scenario.yaml failed with exception: <class 'UnboundLocalError'> file: /root/kraken/kraken/pvc/pvc_scenario.py line: 141 #195

Open mallilinux1980 opened 1 month ago

mallilinux1980 commented 1 month ago

scenarios/pvc_scenario.yaml failed with exception: <class 'UnboundLocalError'>

podman run -it --rm --name=disk --net=host --env-host=true -v $KUBECONFIG:/root/.kube/config -v $SCENARIO:/root/kraken/scenarios/pvc_scenario.yaml -d krkn-hub:pvc-scenarios

2024-07-17 02:25:10,381 [INFO] Starting kraken 2024-07-17 02:25:10,390 [INFO] Initializing client to talk to the Kubernetes cluster 2024-07-17 02:25:10,390 [INFO] Generated a uuid for the run: 232d86a6-04ad-4d5e-b5de-8187b0f8a239 2024-07-17 02:25:20,834 [INFO] Fetching cluster info 2024-07-17 02:25:22,498 [INFO] Cluster version is 4.12.32 2024-07-17 02:25:22,498 [INFO] Server URL: https://:6443 2024-07-17 02:25:22,499 [INFO] Daemon mode not enabled, will run through 1 iterations

2024-07-17 02:25:22,499 [INFO] Executing scenarios for iteration 0 2024-07-17 02:25:22,499 [INFO] Running PVC scenario 2024-07-17 02:25:22,501 [INFO] Input params: pvc_name: '' pod_name: 'virt-launcher-rodan-223249-137' namespace: 'virtualmachines' target_fill_percentage: '75%' duration: '60s' 2024-07-17 02:25:43,240 [INFO] Volume name: os-disk 2024-07-17 02:25:43,241 [INFO] PVC name: rodan-223249-137-os 2024-07-17 02:25:43,241 [ERROR] scenario: scenarios/pvc_scenario.yaml failed with exception: <class 'UnboundLocalError'> file: /root/kraken/kraken/pvc/pvc_scenario.py line: 141

$ cat scenarios/pvc_scenario.yaml pvc_scenario: pvc_name:
pod_name: virt-launcher-rodan-223249-137
namespace: virtualmachines
fill_percentage: 75
duration: 60

mallilinux1980 commented 1 month ago

anyway to get it fixed?

tsebastiani commented 1 month ago

Hi @mallilinux1980, sorry for the late response. I'm afraid that you're not running the scenario as suggested in the documentation, infact you're trying to mount the yaml config file as a volume instead of exposing the requested parameters as environment variables. I've just tested the scenario with this syntax: podman run --name=pvc --net=host --env-host=true -v $(pwd)/kubeconfig:/home/krkn/.kube/config:Z -e POD_NAME=elasticsearch-master-0 -e NAMESPACE=default -e FILL_PERCENTAGE=65 -e DURATION=60 quay.io/krkn-chaos/krkn-hub:pvc-scenarios and works perfectly fine!

Please let us know if you have further questions or issues running krkn-hub scenario, you can also reach out directly on slack https://kubernetes.slack.com, #krkn channel.

mallilinux1980 commented 1 month ago

re-tried but same error. $ podman run --name=disk --net=host --env-host=true -v /tmp/.kube/kubeconfig-42:/home/krkn/.kube/config -e POD_NAME=virt-launcher-d12472-064 -e NAMESPACE=virtualmachines -e FILL_PERCENTAGE=65 -e DURATION=60 quay.io/krkn-chaos/krkn-hub:pvc-scenarios

2024-07-29 08:40:23,824 [INFO] Executing scenarios for iteration 0 2024-07-29 08:40:23,824 [INFO] Running PVC scenario 2024-07-29 08:40:23,827 [INFO] Input params: pvc_name: '' pod_name: 'virt-launcher-d12472-064' namespace: 'virtualmachines' target_fill_percentage: '65%' duration: '60s' 2024-07-29 08:40:45,544 [INFO] Volume name: os-disk 2024-07-29 08:40:45,544 [INFO] PVC name: d12472-064-os 2024-07-29 08:40:45,544 [ERROR] scenario: scenarios/pvc_scenario.yaml failed with exception: <class 'UnboundLocalError'> file: /home/krkn/kraken/kraken/pvc/pvc_scenario.py line: 141

tsebastiani commented 1 month ago

did you try to clear your local image cache (just in case)?

mallilinux1980 commented 1 month ago

yes but no luck.