Getting below error in hivemq pod logs after deployment.
Getting bind address from container hostname
set bind address from container hostname to 10.47.0.1
chown: changing ownership of ‘/opt/hivemq/conf/config.xml’: Read-only file system
The way we handle this in the Kubernetes image is by creating a override directory from which we symlink the files to the actual conf directory. This would require an additional pre-entry script in your case, thus also requiring to use another image.
You could try using the hivemq/hivemq4:k8s-4.3.5 image and set the mountPath to /conf-override/conf instead (no subPath required)
Or you could also try our new HiveMQ Kubernetes Operator EAP, which makes deploying HiveMQ on K8s much easier (and should allow for all the customization you need):
By the way, it is risky to run Pods exposed to external traffic as privileged: true, you should consider the sysctl values at the node level if possible.
The main script of interest is the pre-entry_1.sh: docker run hivemq/hivemq4:k8s-4.3.4 cat /opt/pre-entry_1.sh
It is not easily adaptable for your use case though, as it uses a shared volume with an initContainer that initializes the folder structure.
For your case something like this as a pre-entry should work:
Is it right way to do? or i missing something else.
Below are the errors
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hivemq-cluster-687b59cbd7-j76b8 0/1 Init:CrashLoopBackOff 6 7m45s
hivemq-cluster-687b59cbd7-pfx5b 0/1 Init:CrashLoopBackOff 6 7m45s
hivemq-cluster-687b59cbd7-zs9mx 0/1 Init:CrashLoopBackOff 6 7m45s
$ kubectl logs hivemq-cluster-687b59cbd7-j76b8
Error from server (BadRequest): container “hivemq-sit-pods” in pod “hivemq-cluster-687b59cbd7-j76b8” is waiting to start: PodInitializing
An initContainer has its own, separate file system from the actual hivemq container. The commands i specified above need to run in the hivemq container itself, which is why you will need to use a separate pre-entry script like we did in the DNS discovery image, that will create the folders and symlinks. You can only add a pre-entry script by creating your own hivemq image with the dns image as a base and adding the pre-entry script to that image, which will then exec the DNS pre-entry at the end.
So decoupling configs of hivemq and extensions is not easy with hivemq dns image (I mean own customization with docker hivemq dns image not easy in kubernetes cluster.)
If i use hivemq base image for pre-entry script then hivemq clustering also need to enable with dns discovery extension. but i have not done it. It will be more changes in manifest files of k8s.
Yes, unfortunately in this case it’ll be a bit complicated. The root cause here lies within the base image, so as i see it, your best bet is building a slightly customized image with a pre-entry script from the dns image.
We will make sure to improve how we handle readOnly volumes soon, but i’m afraid we likely won’t be able to re-release the 4.2.1 image you need because changing the underlying layers / scripts may very well lead to problems for other users that are also using the image in production right now.
In shorts customization is not possible with previous blog and need more modification and its complicated. All configs of hivemq and extensions hard coded in docker image.
But why we are getting ReadOnly FileSystem error while mounting volume in same path.
chown: changing ownership of ‘/opt/hivemq/conf/config.xml’: Read-only file system
So we need to go with newer blog which you have share for better customization and automation of hivemq deployment on k8s cluster.
Please go and make a changes in latest hivemq version and let us know. It will be good if ReadyOnly issue resolve.
You opened a ticket in the HiveMQ Community Forum, specifically the HiveMQ Community Edition sub forum.
Our team and community are, as you see very helpful and provided you with a quick solution in using our k8s operator.
It sounds to me like you are looking to get commercial support for a commercial HiveMQ license. In this case please reach out via the appropriate support channels.
PS: HiveMQ has a minimum requirement of 4 CPUs per instance
how to expose ports outside k8s clsuer using NodePort service, we are not using load balancer service
We are already using commercial product and HiveMQ deployed on VM and now we are going to move on kubernetes platform.
Hence need your help to how to deploy on HiveMQ cluster on k8s as you provide good steps in previous blog and we had followed too but customization is difficult in that.
I went through documents but not much details available. Only extensions info given but how to deploy HiveMQ cluster and how to expose service using NodePort not priovided.
It shows how to install a HiveMQ Cluster, with an exposed service in 1 step, using a single config file.
Again, this is the HiveMQ community forum. In case you are looking for extended commercial support for your production environment, feel free to reach out via the proper channels.