Skip to content

wdmartins/active-standby

Repository files navigation

active-standby

This repository provides an example of Kubernetes active/standby deployment solution for HA mission critical applications.

Prerrequisites

The following applications need to be installed. Besides the versions used to test the project.

  • Minikube (1.24.0)
  • Redis (6.2.0)
  • Docker (20.10.8)

Setup

  • Clone or download this repository
  • Create container images
./buildContainers.sh
  • Start minikube with 4 nodes and docker driver
minikube start -n 4 --driver=docker
  • Apply cluster configuration
pushd k8s;                     \
kubectl apply -f rbac.yaml;    \
kubectl apply -f app.yaml;     \
kubectl apply -f service.yaml; \
kubectl apply -f audit.yaml;   \
popd
  • Access the web interface
minikube service app-service

Test fail take over

On the web browser execute start application command:

http://server-address:port/start

the status is now running.

Delete the active pod:

kubectl get pods --show-labels
kubectl delete pod `<name of the active pod>

Wait for the standby pod to take over:

kubectl get pods --show-labels

On the web browser execute state application command:

http://server-address:port/start

Note the state is kept as running but the pod name is different. The standby pod has taken over.

Update label with kubectl

To see the audit function fixing pod state inconsistencies change the standby pod to active.

kubectl label pods --overwrite `<standby pod>` mode=active

Access the kubernetes dashboard

If you are more confortable using UI start the Minikube dashboard:

minikube dashboard

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published