While recently demonstrating BWCE, I realized that rather than using Consul, I could easily use native K8s concepts. I was already using Kubernetes services instead of the Consul Service Discovery (because its just so cool!). I decided to read a bit on ConfigMaps and realized its really easy and with the new features added in BWCE Studio, I can externalize configuration very easily. So let’s begin.
I am using the Bookstore sample shipped with BWCE. The only changes I did there was to create a new profile (by clicking the New Profile button) and names it k8s. After which I clicked the Export Profile button which tokenized my profile correctly and created a properties file. Screenshots below:
You will need to add the below line to your properties file as well:BW_PROFILE=k8s
With this done the only part left was to create a configmap with the below command:kubectl create configmap bookstore-config --from-env-file=k8sprofile.properties
Create a docker image of the bookstore demo and push it to the right registry (I have used minikube). After which just type the magic command ofkubectl apply -f bookstore-demo.yaml
With this done the only part left was to create a configmap with the below command:kubectl create configmap bookstore-config --from-env-file=k8sprofile.properties
Create a docker image of the bookstore demo and push it to the right registry (I have used minikube). After which just type the magic command ofkubectl apply -f bookstore-demo.yaml
If all goes well you should see this in your pod logs:
And that’s it! You have successfully used ConfigMaps to externalize your values with just a few clicks. All the artifacts are checked in on Github here.
Happy Exploring Cloud Native. Next step, Linkerd!
Pingback: Using Linkerd with TIBCO BusinessWorks Container Edition – Blinking Cursor