diff --git a/cluster/kube-up.sh b/cluster/kube-up.sh index 70a4e9339cb..3da66e7abe7 100755 --- a/cluster/kube-up.sh +++ b/cluster/kube-up.sh @@ -46,15 +46,8 @@ KUBE_TEMP=$(mktemp -d -t kubernetes.XXXXXX) trap "rm -rf ${KUBE_TEMP}" EXIT get-password -echo "Generating password: $user:$passwd" +echo "Using password: $user:$passwd" htpasswd -b -c ${KUBE_TEMP}/htpasswd $user $passwd -cat << EOF > ~/.kubernetes_auth -{ - "User": "$user", - "Password": "$passwd" -} -EOF -chmod 0600 ~/.kubernetes_auth HTPASSWD=$(cat ${KUBE_TEMP}/htpasswd) ( diff --git a/cluster/util.sh b/cluster/util.sh index 0419238d2a5..51f5acd8b1a 100755 --- a/cluster/util.sh +++ b/cluster/util.sh @@ -89,5 +89,14 @@ function get-password { fi user=admin passwd=$(python -c 'import string,random; print "".join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16))') + + # Store password for reuse. + cat << EOF > ~/.kubernetes_auth +{ + "User": "$user", + "Password": "$passwd" +} +EOF + chmod 0600 ~/.kubernetes_auth }