0

I am writing an experiment of killing or restarting pod on AKS as a part of chaos engineering initiative. Is there any python sdk available for the same? Sdk in other language is also fine.

Batman22
  • 376
  • 4
  • 25

2 Answers2

0

Kubernetes python client can be used to kill or restart pod as well as perform other actions by loading the kubeconfig file and giving access to the cluster.

Sample Code :-

def killPods():
    config.load_kube_config("kubeconfigpath")
    v1 = client.CoreV1Api()
    ret = v1.list_namespaced_pod("namespace")
    for i in ret.items:
        v1.delete_namespaced_pod("podname", "namespace")
        break
Batman22
  • 376
  • 4
  • 25
0

Gremlin enables you to run shutdown/restart attacks on Kubernetes pods and replicasets.

Install the helm chart: https://github.com/gremlin/helm/ and then you can get started.