kubectl 1.37 cheatsheet

kubectl 1.37: Config and secrets

3 common kubectl 1.37 tasks.

Create a ConfigMap from a file

Store a file's contents as configuration.

kubectl create configmap app-config --from-file=app.properties

Create a secret

Store a value as a Secret. Use a real value and avoid leaving it in shell history.

kubectl create secret generic db --from-literal=password=change-me

Read a secret value

Decode one key of a Secret.

kubectl get secret db -o jsonpath='{.data.password}' | base64 -d

Caution: This prints the secret in your terminal.

Was this page helpful?