공부하기싫어

목차

     

    1. 에러 상황

    pod 실행 후 실행 과정에서 

    Exception : string indices must be integers

    에러 발생

     

    2. 원인 파악

    k get all -n prototype
    NAME                                     READY   STATUS    RESTARTS   AGE
    pod/eth-at-prototype-v1-28123200-kmlbh   1/1     Running   0          2d11h
    pod/eth-at-prototype-v1-28124640-lxs7h   1/1     Running   0          35h
    pod/eth-at-prototype-v1-28126080-rccf6   1/1     Running   0          11h
    
    NAME                                SCHEDULE    SUSPEND   ACTIVE   LAST SCHEDULE   AGE
    cronjob.batch/eth-at-prototype-v1   0 0 * * *   False     3        11h             5d16h
    
    NAME                                     COMPLETIONS   DURATION   AGE
    job.batch/eth-at-prototype-v1-28123200   0/1           2d11h      2d11h
    job.batch/eth-at-prototype-v1-28124640   0/1           35h        35h
    job.batch/eth-at-prototype-v1-28126080   0/1           11h        11h

     

    이전 pod 가 끝나지 않아서 제거 후 pod 내 python app 을 재실행시켰더니 running 으로 실행됨

     

    3. 해결

    - 종료되지 않았던 job 을 제거함으로써 배치된 이전 날짜들의 pod 제거

    - 정상 실행 확인

    $ k get all -n prototype
    NAME                                     READY   STATUS    RESTARTS        AGE
    pod/eth-at-prototype-v1-28126080-rccf6   1/1     Running   1 (3m37s ago)   11h
    
    NAME                                SCHEDULE    SUSPEND   ACTIVE   LAST SCHEDULE   AGE
    cronjob.batch/eth-at-prototype-v1   0 0 * * *   False     1        11h             5d17h
    
    NAME                                     COMPLETIONS   DURATION   AGE
    job.batch/eth-at-prototype-v1-28126080   0/1           11h        11h
    
    $ k exec -it eth-at-prototype-v1-28126080-rccf6 -n prototype /bin/bash
    # head output20230624.log
    success : get_parameter_fromSSM, read_dynamoDB_table
    success : login
    start daily autotrade : 2023-06-24 11:52:54.507293
    running :2023-06-24 11:53:07.126560
    running :2023-06-24 11:53:19.634988
    running :2023-06-24 11:53:32.065667