Home > Mobile >  Get ca-cert.pem field of a kubernetes secret
Get ca-cert.pem field of a kubernetes secret

Time:06-05

In my istio-system namespace, I have the following secret

▶ k get secret istio-ca-secret -o yaml
apiVersion: v1
data:
  ca-cert.pem: LS0tLS1CR...
  ca-key.pem: LS0..
  cert-chain.pem: ""
  key.pem: ""
  root-cert.pem: ""

While the following query works:

kubectl get secret istio-ca-secret -n istio-system  -o jsonpath="{.data}"
{"ca-cert.pem":"LS0t=...","ca-key.pem":"LS0tLS1","cert-chain.pem":"","key.pem":"","root-cert.pem":""}%       

the following, which I execute trying to get only the ca-cert.pem value returns nothing

kubectl get secret istio-ca-secret -n istio-system  -o jsonpath="{.data.ca-cert.pem}"

why is that?

CodePudding user response:

you need to escape the dot in "ca-cert.pem" to work.

like this

kubectl get secret istio-ca-secret -n istio-system  -o jsonpath="{.data.ca-cert\.pem}"
  • Related