Zero Downtime Deployments
technical kubernetes deployment iaas paasAnd Example of Zero Downtime Deployment
Overview
Kubernetes based platforms like OpenShift support zero downtime deployments using advanced deployment strategies like:
Most of these patterns require that your application supports [N-1 Compatibility]1
An Example
Step 1. Login using CLI
oc login [api-url] --token=[token]
Step 2. Download the example from Docker hub
docker pull openshift/deployment-example
Step 3. Create a new project
oc new-project rolling
# Ensure we are using the created project
oc project rolling
Step 4. Create an application based on the example image downloaded
oc new-app openshift/deployment-example
Step 5. Expose the service to the external traffic
oc new-app openshift/deployment-example
Step 6. Get external endpoint for the service
oc get routes
The external endpoint should be identified by HOST/PORT for deployment-example
Step 7. Scale the deployment to 3 replicas
oc scale dc/deployment-example --replicas=3
Step 8. Create an application with openshift/deployment-example:v2
image
This is a workaround so that
openshift/deploymenteample:v2
image is available in the project
Step 9. Trigger rolling
deployment by changing target image via tag
oc tag deployment-example-2:v2 deployment-example:latest
-
Since many applications depend on persistent data, you will need to have an application that supports N-1 compatibility, which means you share data and implement live migration between your database, store, or disk by creating two copies of your data layer. ↩