One simple way to pull the new image into your cluster is to overwrite the latest
tag, specify imagePullPolicy: always
in your deployment and then use kubectl rollout restart deployment my-static-site
from within your pipeline to restart all pods. Kubernetes will then terminate all pods and replace them with new ones that pull the latest image.
You can also work with versioned tags and kubectl set image deployment/my-static-site site=my/image:version
. This might be a bit nicer and allows imagePullPolicy: IfNotPresent
, but you have to pass your version number into your pipeline somehow, e.g. with git tags.
ArbiterXero@lemmy.world 1 year ago
K8s is that “restart” mechanism.
Docker images are just the thing that it restarts.
Docker itself or “docker compose” can restart images and do everything you need, but if you want to go the full k8s it’s complicated but great learning