Reputation: 642
We have a requirement that no requests receive 404's when doing a rolling deploy. Currently we achieve this by deploying the new assets container to all servers before continuing with a rolling deploy. With nginx's "try_files" this ensures that as the new code is being rolled out we can serve both the old and new versions of assets. Does Kubernetes have any features to support this type of workflow?
Upvotes: 2
Views: 412
Reputation: 2748
One possibility would be using Deployments. You can run a Deployment with several Replica's.
Now when you update to a new version, the Deployment takes care that one old version is removed and a new version is added one after another until your new version is fully rolled out. The rollout strategy can be
When running nginx in your Pod's for serving static files, I would suggest adding the following to your container specification:
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx", "-s", "quit"]
This will send a QUIT
Signal to your nginx before the Pod is getting destroyed. This way you can be sure that no new connections get accepted by nginx, just before the server is going down.
Upvotes: 0
Reputation: 2835
You can either use Deployment
API (for Kubernetes >= v1.2) or kubectl rolling-update
(for < v1.2) to manage the rolling deploy of your Kubernetes Pod
s (each is a co-located group of containers and volumes). You'll also need to create Service
s for accessing those Pod
s (Service
s redirect traffic to Pod
s). During the rolling deploy, a user will be redirected to either the Pod
with old or new versions of assets container.
Upvotes: 1