Skip to content

Instantly share code, notes, and snippets.

@rleap-m
Created November 15, 2024 14:22
Show Gist options
  • Save rleap-m/33024b6912eaf6dd00ffdac03b5c82eb to your computer and use it in GitHub Desktop.
Save rleap-m/33024b6912eaf6dd00ffdac03b5c82eb to your computer and use it in GitHub Desktop.
MKE4 change admin password by changing password hash
# Courtesy Dmitrii in a Slack channel
NAME=admin
NEW_PASSWORD=mke4mke4mke4
export HASHED=$(htpasswd -nbBC 10 '' "$NEW_PASSWORD" | tr -d ':\n' | base64)
alias km="kubectl -n mke --kubeconfig ~/.mke/mke.kubeconf"
km get password $(km get password -o jsonpath="{.items[?(@.email=='$NAME')].metadata.name}") -oyaml | yq '.hash = strenv(HASHED)' | km -n mke apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment