less than 1 minute read

Given the following .dockerconfigjson type secret in Kubernetes:

{
    "apiVersion": "v1",
    "data": {
        ".dockerconfigjson": "kjhsadflkjhasdlfkhjasdlkfjhlasdkjhflaskdjhflkasjdhf….”
    },
    "kind": "Secret",
…

Getting the secret data with kubectl and jsonpath, you need to escape the period that is part of the filename:

kubectl get secret mysecret -n mynamespace -o jsonpath='{.data.\.dockerconfigjson}'