A tool to process KUBECONFIG
files with secrets as file paths replacing them
with actual base64 encoded contents of those secrets.
It is useful to move KUBECONFIG
(typically generated by minikube)
files to different machines.
It is safe to invoke it on any YAML file as it does not do the replacement
unless it finds the expected paths in the input. It also does not do in-place
replacement, and the caller should redirect the output to a file.
docker build . -t kubeconfig-exporter:latest
cat /root/.kube/config | \
docker run -i --rm \
-v /root/.minikube:/root/.minikube \
kubeconfig-exporter:latest > \
new.kubeconfig
Note that in the above example, the input file is located at /root/.kube/config
and this file is referencing paths in /root/.minikube
. This is why it has to
be mounted inside the container. Also, in this example the output is saved
in new.kubeconfig
on the host machine.
Run directly from Docker Hub by referencing qcrisw/kubeconfig-exporter:latest
as the docker image repository:
cat /root/.kube/config | \
docker run -i --rm \
-v /root/.minikube:/root/.minikube \
qcrisw/kubeconfig-exporter:latest > \
new.kubeconfig