Skip to content

Instantly share code, notes, and snippets.

@kjivan
Last active April 2, 2021 21:52
Show Gist options
  • Save kjivan/3d8478c60a8436d0bae33ed49ae23de4 to your computer and use it in GitHub Desktop.
Save kjivan/3d8478c60a8436d0bae33ed49ae23de4 to your computer and use it in GitHub Desktop.
Kubectl Reference

Extract Truststore from secret

kubectl get secret <secret> \
-o json \
| jq --raw-output '. | .data."<trust-store>.jks"' \
| base64 -D > <trust-store>.jks

Patch Secret with TrustStore

Bash

kubectl patch secret <secret> \
--type=json \
-p='[{"op": "replace", "path": "/data/<truststore>", "value": "'$(base64 <file>)'"}]'

Fish

kubectl patch secret <secret> \
--type=json \
-p='[{"op": "replace", "path": "/data/<truststore>", "value": "'(base64 <file>)'"}]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment