Passing long configuration file to Kubernetes

7/9/2018

I like the work methology of Kuberenetes, use self-contained image and pass the configuration in a ConfigMap, as a volume.

Now this worked great until I tried to do this thing with Liquibase container, The SQL is very long ~1.5K lines, and Kubernetes rejects it as too long.

Error from Kubernetes:

The ConfigMap "liquibase-test-content" is invalid: metadata.annotations: Too long: must have at most 262144 characters

I thought of passing the .sql files as a hostPath, but as I understand these hostPath's content is probably not going to be there

Is there any other way to pass configuration from the K8s directory to pods? Thanks.

-- aclokay
kubernetes

1 Answer

7/9/2018

You can use an init container for this. Essentially, put the .sql files on GitHub or S3 or really any location you can read from and populate a directory with it. The semantics of the init container guarantee that the Liquibase container will only be launched after the config files have been downloaded.

-- Michael Hausenblas
Source: StackOverflow