How to pass args to pods based on Ordinal Index in StatefulSets?

后端 未结 5 1214
再見小時候
再見小時候 2021-01-04 19:43

Is it possible to pass different args to pods based on their ordinal index in StatefulSets? Didn\'t find the answer on the StatefulSets documentation. Thanks!

5条回答
  •  隐瞒了意图╮
    2021-01-04 20:11

    You can avoid using the Downward API by using HOSTNAME:

    command:
    - bash
    - c
    - |
      ordinal=${HOSTNAME##*-}  
      if [[ "$ordinal" = "0" ]]; then
        ...
      else
        ...
      fi 
    

提交回复
热议问题