コピペ: Let kubernetes or docker-compose redeploy containers although the tag didn't change

形式
Plain text
投稿日時
2021-04-24 04:56
公開期間
無期限
  1. More often that not, especially in setups that aren't necessarily near the state of the art (or are constrained), one has containers with the same tag and wants to redeploy them.
  2. What is the easier way? Remove the container/pod and let kubernetes/docker-compose redeploy it. Thus
  3. #delete the pod
  4. kubectl delete pods -l myLabel=value
  5. # the deployment/controller will redeploy it
  6. This is a way around the built in mechanism of redeployment, that actually is better because kubernetes has redeployment strategies that otherwise get bypassed if things just disappear.
  7. Same with docker compose
  8. # delete it
  9. docker rm -f container_id
  10. # redeploy
  11. docker-compose up -d
  12. One way to avoid this, and let the built in mechanism to work, is to change the definition of the deployment in kubernetes or the service in docker-compose. Simply add a dummy attribute and change it. Example an environment variable, say REDEPLOY_HELPER : "2021-04-23 21:55" (a readable timestamp)
  13. In that case kubernetes will redeploy things on his own, no dirt delete needed and with docker-compose one would need a simple:
  14. docker-compose up -d
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト