Secret update k8s
Jump to navigation
Jump to search
OK
kubectl create secret generic ssl-certs --from-file=ca-certificates.crt=./etc-ssl-certs/ca-certificates.crt --save-config --dry-run=client -o yaml | kubectl apply --server-side=true -f -
Better
TLS_KEY=$(base64 < "./tls.key" | tr -d '\n') TLS_CRT=$(base64 < "./tls.crt" | tr -d '\n') kubectl get secrets production-tls -o json \ | jq ".data[\"tls.key\"] |= \"$TLS_KEY\"" \ | jq ".data[\"tls.crt\"] |= \"$TLS_CRT\"" \ | kubectl apply -f -
Patch
kubectl \ patch \ secret \ production-tls \ -p "{\"data\":{\"tls.key\":\"${TLS_KEY}\",\"tls.crt\":\"${TLS_CRT}\"}}"