简体   繁体   中英

Hosting jar files on Kubernetes ConfigMap

Is this a good idea to host java jar files on ConfigMap when we want to extend a JVM classpath?

Normally the application itself is baked into docker image but extending it(via plugin jar etc.) requires either attaching volume, copying the jar file to the volume and and restart the pod but you need a volume to do that. The other option is to put directly the jar into ConfigMap as binary object and restart the pod. The latter seems easier and faster and it should work for small size jar files.

No, ConfigMaps are designed for metadata only. In fact etcd (the default key/value store in kubernetes) object size is capped at 1MB.

What you could do is host the jars in a different service and have an init container download the files before the java service starts.

It looks like a workaround to put jar into the config maps. Try another solution.

Why can not you pack this dependency on docker image?

You can use a init container as pointed by @reegnz

The docs of this feature are here:

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM