This part of the repository implements two strategies for updating the TeaStore application. Next to the rolling upgrade strategy, which is managed by K8s, a self-managed blue-green strategy is proposed.
The rolling upgrade strategy managed by K8s iteratively updates the application. Via the parameters maxSurge and maxUnavailable the amount of additional and non-available pods at any time can be specified. In this example, only the TeaStore WebUI is updated to its latest image. Per default 3 replicas are created to visualize the update process.
- Provisioned EKS Cluster: Baseline Architecture.
- Connection to the cluster (via
aws eks --region us-east-2 update-kubeconfig --name eks-cluster
). - AWS CLI - A command line tool for interacting with AWS services.
- kubectl - A command line tool for working with Kubernetes clusters.
- Deploy (here the outdated) version of TeaStore application via:
kubectl apply -f TeaStore\teastore-upgrade.yaml
. - Set the image to
:latest instead of :1.4.2
. - Run
kubectl apply -f TeaStore\teasture-upgrade.yaml
. - Monitor Update process: During the update process, 4 isntead of 3 replicas should be created. Status should change from running to terminated for outdated pods one after another. AGE indicates which pods are newly created (with the latest version) and which ones are outdated.
Alternatively, explicitly update specific image via:
kubectl set image -n teastore-namespace deployments/teastore-webui teastore-webui=descartesresearch/teastore-webui:latest
- Remove application from the cluster:
kubectl delete -f TeaStore\teastore-upgrade.yaml
. Terraform destroy
confirm withyes
. This may take up to 20 min. (Conduct within cluster directory)
For conducting updates based on the blue-green strategy, several mechanisms exist. Instead of recreating the whole application, this approach dupplicates the service to be updated and redirects traffic to the newer version. This method can easily be expanded to recreating all deployments.
Outdated deployments are labelled as color:blue, while the latest version is labelled as color:green. Via the service component traffic is redirect to the latest version through adjsuting the selector to color:green.
- Provisioned EKS Cluster: Baseline Architecture.
- Connection to the cluster (via
aws eks --region us-east-2 update-kubeconfig --name eks-cluster
). - AWS CLI - A command line tool for interacting with AWS services.
- kubectl - A command line tool for working with Kubernetes clusters.
- Deploy (here the outdated) version of TeaStore application via:
kubectl apply -f TeaStore\teastore-bg.yaml
. - Set the image to
:latest instead of :1.4.2
. - Update the webui deployment to
color:green
where #adjust (1). - Run
kubectl apply -f TeaStore\teasture-bg.yaml
. - This creates a second deployment of the webui with the latest image (
kubectl -n teastore-namespace get deployments
). - Redirect traffic to the latest deployment by changing
color:green
for the WebUI service where #adjust (2). - Delete teastore-webui-blue
kubectl -n teastore-namespace delete deployment teastore-webui-blue
.
- Remove application from the cluster:
kubectl delete -f TeaStore\teastore-bg.yaml
. Terraform destroy
confirm withyes
. This may take up to 20 min. (Conduct within cluster directory)