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

Only able to run pod delete experiment #4026

Open
senju-hashirama opened this issue Jun 28, 2023 · 2 comments
Open

Only able to run pod delete experiment #4026

senju-hashirama opened this issue Jun 28, 2023 · 2 comments
Assignees

Comments

@senju-hashirama
Copy link

Question

So we have a 1 node cluster and we are trying to run chaos experiments on it. We were able to run the pod delete experiment on our deployment but not pod-cpu-hog and pod-memory-hog. We keep getting this error even after editing the chaos engine.yaml file to suit our deployment.

 failedStep: '{"errorCode":"STATUS_CHECKS_ERROR","phase":"ChaosInject","reason":"helper
        status check failed: no pods found with mathcing
        labels","target":"{podLabel: app=pod-cpu-hog-helper-uldogk, namespace:
        litmus}"}'

Here is the engine.yaml file:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: custom-1687958347
  namespace: litmus
spec:
  arguments:
    parameters:
      - name: adminModeNamespace
        value: litmus
  entrypoint: custom-chaos
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
  serviceAccountName: argo-chaos
  templates:
    - name: custom-chaos
      steps:
        - - name: install-chaos-experiments
            template: install-chaos-experiments
        - - name: pod-cpu-hog-vkc
            template: pod-cpu-hog-vkc
    - name: install-chaos-experiments
      inputs:
        artifacts:
          - name: pod-cpu-hog-vkc
            path: /tmp/pod-cpu-hog-vkc.yaml
            raw:
              data: >
                apiVersion: litmuschaos.io/v1alpha1

                description:
                  message: |
                    Injects cpu consumption on pods belonging to an app deployment
                kind: ChaosExperiment

                metadata:
                  name: pod-cpu-hog
                  labels:
                    name: pod-cpu-hog
                    app.kubernetes.io/part-of: litmus
                    app.kubernetes.io/component: chaosexperiment
                    app.kubernetes.io/version: 3.0.0-beta3
                spec:
                  definition:
                    scope: Namespaced
                    permissions:
                      - apiGroups:
                          - ""
                        resources:
                          - pods
                        verbs:
                          - create
                          - delete
                          - get
                          - list
                          - patch
                          - update
                          - deletecollection
                      - apiGroups:
                          - ""
                        resources:
                          - events
                        verbs:
                          - create
                          - get
                          - list
                          - patch
                          - update
                      - apiGroups:
                          - ""
                        resources:
                          - configmaps
                        verbs:
                          - get
                          - list
                      - apiGroups:
                          - ""
                        resources:
                          - pods/log
                        verbs:
                          - get
                          - list
                          - watch
                      - apiGroups:
                          - ""
                        resources:
                          - pods/exec
                        verbs:
                          - get
                          - list
                          - create
                      - apiGroups:
                          - apps
                        resources:
                          - deployments
                          - statefulsets
                          - replicasets
                          - daemonsets
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - apps.openshift.io
                        resources:
                          - deploymentconfigs
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - ""
                        resources:
                          - replicationcontrollers
                        verbs:
                          - get
                          - list
                      - apiGroups:
                          - argoproj.io
                        resources:
                          - rollouts
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - batch
                        resources:
                          - jobs
                        verbs:
                          - create
                          - list
                          - get
                          - delete
                          - deletecollection
                      - apiGroups:
                          - litmuschaos.io
                        resources:
                          - chaosengines
                          - chaosexperiments
                          - chaosresults
                        verbs:
                          - create
                          - list
                          - get
                          - patch
                          - update
                          - delete
                    image: litmuschaos/go-runner:3.0.0-beta3
                    imagePullPolicy: Always
                    args:
                      - -c
                      - ./experiments -name pod-cpu-hog
                    command:
                      - /bin/bash
                    env:
                      - name: TOTAL_CHAOS_DURATION
                        value: "60"
                      - name: CPU_CORES
                        value: "1"
                      - name: CPU_LOAD
                        value: "100"
                      - name: PODS_AFFECTED_PERC
                        value: ""
                      - name: RAMP_TIME
                        value: ""
                      - name: LIB_IMAGE
                        value: litmuschaos/go-runner:3.0.0-beta3
                      - name: STRESS_IMAGE
                        value: alexeiled/stress-ng:latest-ubuntu
                      - name: CONTAINER_RUNTIME
                        value: docker
                      - name: SOCKET_PATH
                        value: /var/run/docker.sock
                      - name: TARGET_PODS
                        value: ""
                      - name: NODE_LABEL
                        value: ""
                      - name: SEQUENCE
                        value: parallel
                    labels:
                      name: pod-cpu-hog
                      app.kubernetes.io/part-of: litmus
                      app.kubernetes.io/component: experiment-job
                      app.kubernetes.io/runtime-api-usage: "true"
                      app.kubernetes.io/version: 3.0.0-beta3
  container:
    args:
      - kubectl apply -f /tmp/pod-cpu-hog-vkc.yaml -n
        {{workflow.parameters.adminModeNamespace}} &&  sleep 30
    command:
      - sh
      - -c
    image: litmuschaos/k8s:3.0.0-beta3
- name: pod-cpu-hog-vkc
  inputs:
    artifacts:
      - name: pod-cpu-hog-vkc
        path: /tmp/chaosengine-pod-cpu-hog-vkc.yaml
        raw:
          data: |
            apiVersion: litmuschaos.io/v1alpha1
            kind: ChaosEngine
            metadata:
              namespace: "{{workflow.parameters.adminModeNamespace}}"
              generateName: pod-cpu-hog-vkc
              labels:
                workflow_run_id: "{{workflow.uid}}"
            spec:
              engineState: active
              appinfo:
                appns: emojivoto
                applabel: kube-monkey/identifier=monkey-victim
                appkind: deployment
              chaosServiceAccount: litmus-admin
              experiments:
                - name: pod-cpu-hog
                  spec:
                    components:
                      env:
                        - name: TOTAL_CHAOS_DURATION
                          value: "60"
                        - name: CPU_CORES
                          value: "1"
                        - name: PODS_AFFECTED_PERC
                          value: ""
                        - name: CONTAINER_RUNTIME
                          value: docker
                        - name: SOCKET_PATH
                          value: /var/run/docker.sock
                    probe: []
  container:
    args:
      - -file=/tmp/chaosengine-pod-cpu-hog-vkc.yaml
      - -saveName=/tmp/engine-name
    image: litmuschaos/litmus-checker:3.0.0-beta3
@oumkale
Copy link
Member

oumkale commented Aug 24, 2023

Hi @senju-hashirama,

Thanks for checking out in experiments, On looking into the issue seems like the app details were not passed correctly.
Can you please pass the below envs as well in ChaosEngine?

                       - name: APP_NAMESPACE
                          value: ""
                        - name: APP_LABEL
                          value: ""
                        - name: APP_KIND
                          value: ""

@ksatchit
Copy link
Member

ksatchit commented Jan 2, 2024

@senju-hashirama - the issue seems to be an inability to create the helper pod (you can see the error message calls out that it couldn't detect a pod with the label app=pod-cpu-hog-helper-uldogk).

Also, can you share what is the kubernetes environment in use here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants