How to keep my pod running (not get terminate/restart) in EKS

Viewed 1418

I am trying to use AWS EKS (fargate) to run automation case, but some pods (9 out of 10 times running) get terminated, makes automation failure.

I have a bunch of automation cases written in robotframework, the case itself is running well, but it is time-consumming, usually need 6 hours for a round. So, I think I can use K8S to run the cases in-parallel, therefore save time, I use Jenkins to config how many 'automations' run in-parallel, and after all done, merge and present the test result.

But some pods aften get terminated,

command "kubectl get pod", return something like this (I set the "restartPolicy: Never" to keep the error pod to 'describe' its info, otherwise, the pod just gone)

box6           0/1     Error     0          9m39s

command "kubectl describe pod box6" get output like following (masked some private information).

Name:                 box6
Namespace:            default
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 XXXXXXXX
Start Time:           Mon, 21 Dec 2020 15:29:37 +0800
Labels:               eks.amazonaws.com/fargate-profile=eksautomation-profile
                      name=box6
                      purpose=demonstrate-command
Annotations:          CapacityProvisioned: 0.25vCPU 0.5GB
                      Logging: LoggingDisabled: LOGGING_CONFIGMAP_NOT_FOUND
                      kubectl.kubernetes.io/last-applied-configuration:
                        {"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"name":"box6","purpose":"demonstrate-command"},"name":"box6","names...
                      kubernetes.io/psp: eks.privileged
Status:               Failed
IP:                   192.168.183.226
IPs:
  IP:  192.168.183.226
Containers:
  box6:
    Container ID:  XXXXXXXX
    Image:         XXXXXXXX
    Image ID:      XXXXXXXX
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/initMock.sh
    State:          Terminated
      Reason:       Error
      Exit Code:    143
      Started:      Mon, 21 Dec 2020 15:32:12 +0800
      Finished:     Mon, 21 Dec 2020 15:34:09 +0800
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-tsk7j (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-tsk7j:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-tsk7j
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason           Age        From                                                            Message
  ----     ------           ----       ----                                                            -------
  Warning  LoggingDisabled  <unknown>  fargate-scheduler                                               Disabled logging because aws-logging configmap was not found. configmap "aws-logging" not found
  Normal   Scheduled        <unknown>  fargate-scheduler                                               Successfully assigned default/box6 to XXXXXXXX
  Normal   Pulling          5m7s       kubelet, XXXXXXXX  Pulling image "XXXXXXXX"
  Normal   Pulled           2m38s      kubelet, XXXXXXXX  Successfully pulled image "XXXXXXXX"
  Normal   Created          2m38s      kubelet, XXXXXXXX  Created container box6
  Normal   Started          2m37s      kubelet, XXXXXXXX  Started container box6

I did some search upon the error, error code 143 is 128+SIGTERM, I am doubting that the pod get killed by EKS intentionally.

I cannot config the pod to have it restart, because if so, the automation case cannot resume, therefore makes the effort useless (not able to save automation running time).

I have tried to enable cloud watch, hoping to get a clue upon why pod get terminated, but no clue.

Why my pod get terminated by EKS? how should I troubleshooting upon it? how should I avoid it?

Thanks for your help.

0 Answers
Related