linki / chaoskube

chaoskube periodically kills random pods in your Kubernetes cluster.
MIT License
1.8k stars 120 forks source link

Chaoskube does not kill pods and cannot target the chaoskube to specific namespaces #556

Closed Dorsosiv closed 10 months ago

Dorsosiv commented 1 year ago

I deployed chaos kube with the following helm commands:

#! /bin/bash
helm repo add chaoskube https://linki.github.io/chaoskube/
helm install chaoskube chaoskube/chaoskube --atomic --namespace=chaoskube --create-namespace \
  -f values.yaml --set namespaces='test-namespace' --set labels='app=test' ;

and the values.yaml is

---
# replicaCount configures the number of replicas to run
replicaCount: 1

# image specifies image location, tag and pullPolicy
image:
  repository: ghcr.io/linki/chaoskube
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: ""

# chaoskube is used to configure chaoskube
chaoskube:
  env: {}
  envFromConfigMapRefs: []
    # - 'configmap-a'
  args: 
    ######
    # Example configuration, uncomment and adjust to your needs.
    # Be sure to read: https://github.com/linki/chaoskube#flags
    ######
    # kill a pod every 10 minutes
    interval: "1m"
    # only target pods in the test environment
    #labels: "environment=test"
    # only consider pods with this annotation
    #annotations: "chaos.alpha.kubernetes.io/enabled=true"
    # exclude all DaemonSet pods
    #kinds: "!DaemonSet"
    # exclude all pods in the kube-system namespace
    #namespaces: "!kube-system"
    # don't kill anything on weekends
    #excluded-weekdays: "Sat,Sun"
    # don't kill anything during the night or at lunchtime
    #excluded-times-of-day: "22:00-08:00,11:00-13:00"
    # don't kill anything as a joke or on christmas eve
    #excluded-days-of-year: "Apr1,Dec24"
    # let's make sure we all agree on what the above times mean
    #timezone: "UTC"
    # exclude all pods that haven't been running for at least one hour
    #minimum-age: "1h"
    # terminate pods for real: this disables dry-run mode which is on by default
    #no-dry-run: ""

# serviceAccount can be used to customize the service account which will be crated and used by chaoskube
serviceAccount:
  create: true
  name: ""
  annotations: {}

# podAnnotations can be used to add additional annotations to the pod
podAnnotations: {}

# additionalLabels can be used to add additional labels to the pod
additionalLabels: {}

# podSecurityContext is used to customize the security context of the pod
podSecurityContext:
  runAsNonRoot: true
  runAsUser: 65534
  readOnlyRootFilesystem: true
  capabilities:
    drop: ["ALL"]

# resources can be used to limit pod compute resources (limits/requests)
resources: 
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 10m
    memory: 16Mi

# tolerations can be used to configure tolerations for the pods
tolerations: []

I have a few issues:

Please help

linki commented 1 year ago
  • The chaoskube is not terminating the pods at all its just writing in the logs that its going to remove it but its not doing anything.

That's a safety feature, you also need to set no-dry-run: "" in your values.yaml or via the --set flag, see https://github.com/linki/chaoskube/blob/master/chart/chaoskube/README.md#example-helm-values

  • Its not working with the values and the set flags. Its trying to remove pods from namespaces that are not in the filter ...

Please try the following:

helm install ... -f values.yaml --set namespaces=test-namespace,labels=app=test

Also see this comment: https://github.com/helm/helm/issues/3351#issuecomment-366675472