0

I have kubectl configured on my Windows 11 PowerShell command line, it works fine for all commands so far, but when I run the following command reference:

kubectl get secrets/my-app -n my-ns --template={{.data.database_host}}

I get the following error:

error: unknown shorthand flag: 'e' in -encodedCommand
See 'kubectl get --help' for usage.

Does anybody know why?

João Pedro Schmitt
  • 1,046
  • 1
  • 11
  • 25
  • 1
    Does quoting the flag value help: `kubectl get secrets/my-app --namespace=my-new --template="{{.data.database_host}}"`? – DazWilkin Sep 05 '22 at 16:22
  • 1
    As you are getting an error: unknown shorthand flag: 'e' in -encodedCommand, this might be due to not using encoded in the base64 format. Try the syntax below. This might work : kubectl get secrets/db-user-pass --template='{{.data.password | base64decode}}' . Refer this [docker for secrets](https://kubernetes.io/docs/concepts/configuration/secret/#docker-config-secrets) – Hemanth Kumar Sep 06 '22 at 05:45
  • Yes, thanks guy the quoting worked, using either `"` or `'` – João Pedro Schmitt Sep 08 '22 at 12:47

1 Answers1

1

As you are getting an error: unknown shorthand flag: 'e' in -encodedCommand, this might be due to not using encoded in the base64 format. Try the syntax below. This might work : kubectl get secrets/db-user-pass --template='{{.data.password | base64decode}}' . Refer this docker for secrets

Hemanth Kumar
  • 2,728
  • 1
  • 4
  • 19