I need to extract the ca-bundle.crt from the configmap "kubelet-serving-ca" in the namespace "openshift-kube-apiserver" to use it on another configmap and on a pod using the path to the file.
how I can do this?
Thanks!
In order to extract ca-bundle.crt
from the config map kubelet-serving-ca
in the namespace openshift-kube-apiserver
and use it in another configmap, please use the following commands which was provided by “P….” in the comments section.
kubectl get configmap -n openshift-kube-apiserver kubelet-serving-ca
-o jsonpath='{.data.ca-bundle\.crt}' > ca-bundle.crt
If the fields by the jsonpath expression needs to be printed into another file then please use the below command along with the kubectl command.
-o jsonpath-file=<filename>
The syntax kubectl get configmap
retrieves the value of a key from the specified file and the syntax -o jsonpath=<template>
prints the fields defined in a jsonpath expression.
Please refer to the official documentation for more information.