Configuration management on OpenShift, Kubernetes and Docker
When deploying Infinispan on Docker based Cloud environments, the most critical thing is how to manage configuration. In this blog post we’ll explore some of the options.
Extending our Docker image
Creating your own Docker image based on jboss/infinispan-server is quite simple. At first you need to prepare a configuration XML file, which is shipped with Infinispan release. Go to Infinispan download section and grap a server release corresponding to a chosen Docker image tag. After unpacking it, grab the configuration (I use cloud.xml as a template) and introduce all necessary changes.
Finally, build your image:
Now, that was quick! Wasn’t it?
Using ConfigMaps with OpenShift
If you’re using OpenShift, there’s a sophisticated tool called ConfigMap. A ConfigMap can store a configuration file (or a configuration directory) and mount it somewhere in the Pod.
Use the command below to create a ConfigMap based on a configuration file:
Now create Infinispan application based on the configuration below (you can use 'oc create -f <file.yaml>' for this):
(lines 50 - 52) - ConfigMap volume declaration
(lines 45 - 47) - Mounting configuration into /opt/jboss/infinispan-server/standalone/configuration/custom
(line 22) - bootstrapping the Infinispan with custom configuration (note there is no xml extension there)
Using ConfigMaps with Kubernetes
Kubernetes ConfigMaps work exactly the same way as in OpenShift.
The command below creates a ConfigMap:
The second step is to create a Deployment with ConfigMap:
If you’re using any Docker orchestration tool - have a look at provided tools. OpenShift and Kubernetes ConfigMaps are really great for this.
However if you need a fine grained control - either extend our Docker image (this is the preferred way) or simply fork and modify it.
Happy configuring and scaling!
Get it, Use it, Ask us!We’re hard at work on new features, improvements and fixes, so watch this space for more announcements!
Please, download and test the latest release.
The source code is hosted on GitHub. If you need to report a bug or request a new feature, look for a similar one on our JIRA issues tracker. If you don’t find any, create a new issue.
If you have questions, are experiencing a bug or want advice on using Infinispan, you can use StackOverflow. We will do our best to answer you as soon as we can.
The Infinispan community uses Zulip for real-time communications. Join us using either a web-browser or a dedicated application on the Infinispan chat.