Skip to content

ryandawsonuk/configmaps-transformers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes ConfigMaps Transformers Example

Aims

To demonstrate ConfigMaps by swithing Transfomer services between 'disguised' and 'robot' modes in minikube.

Pre-requisites

Docker (https://docs.docker.com/install/) and minikube (https://kubernetes.io/docs/tasks/tools/install-minikube/) installed.

How to Run - kubectl

First Deploy

Start minikube:

minikube start --memory 4000 --cpus 3

Build images for Transformers - from this directory run

eval $(minikube docker-env)
mvn clean install

Deploy the Autobots (their ConfigMap has them as in robot mode)

kubectl create -f autobots --save-config

To see the autobots:

minikube service optimus-prime-entrypoint
minikube service gears-entrypoint

Deploy the Decepticons (their ConfigMap has them disguised)

kubectl create -f decepticons --save-config

minikube service megatron-entrypoint
minikube service shockwave-entrypoint

Changing Config

To change config there are options.

Option 1 - Change with small downtime

Do minikube dashboard to open the dashboard in the browser, go to 'Config Maps' under 'Config and Storage' and e.g. change the Decepticons to 'robot'. Then do:

kubectl scale deployment/megatron --replicas=0;
kubectl scale deployment/megatron --replicas=2;

Option 2 - Change with no downtime

Edit the .yml files for each transformer in the autobots and decepticons directories to point to v2 of the config. Then do:

kubectl apply -f autobots --record
kubectl apply -f decepticons --record

Note it can take a while for the rolling update to be fully applied and also beware the browser cache (and dep on your minikube version you may hit kubernetes/kubernetes#55667).

Remove and Stop

To remove:

kubectl delete -f autobots
kubectl delete -f decepticons

Stop minikube with minikube stop

How to Run - Helm

See the helm directory for instructions