How to transfer 10kb text into pod in kubernetes with a simple way?

3/13/2020

I want to transfer some key-value data, about 1kb~10kb, into a pod in kubernetes. Is there a simple way to achieve this? I don't want to create a configmap each time, because this will happen many many times... Thank you in advance.

-- kyleqian
kubernetes
pod

2 Answers

3/13/2020

Best method to achieve this is to make a file locally and fill the file with your config (key-val pairs) then lets say /tmp/foo.properties is your file containing key-val pairs locally to mount this file in a pod just copy with following command

kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/foo.properties

your file will be present in /tmp/foo.properties

-- Chetanya Chopra
Source: StackOverflow

3/13/2020

You can do with kubectl cp command to copy files into pod.

Other way is to create REST endpoint in the service running inside pod and POST the file to the endpoint.

-- P Ekambaram
Source: StackOverflow