Error return by the Openshift cluster when using the oc tool to retrieve secrets with a key containing a dash(“-”) in it.

Solution

Let’s say the secret is defined in follow namespace &

  • namespace: test
  • name of the secret: `config-parameters`

Secret

kind: Secret
apiVersion: v1
metadata:
name: config-parameters
namespace: test
data:
test-id: dGVzdC12YWx1ZQ==
type: Opaque

Let’s try to retrieve the secret “config-parameters” with the key:”test-id”

Execute the following commands (change the “test-id” accordingly)

export NAMESPACE=testexport NAME=config-parametersoc get secrets/$NAME -n $NAMESPACE —-template=’{{index .data "test-id"}}’|base64 -d

Hope this was helpful. Thank you for reading.

--

--