Last active
March 29, 2019 18:08
-
-
Save carlessanagustin/6bd1558ec20f34156babc92e70a33159 to your computer and use it in GitHub Desktop.
Generate Docker Registry resource for Kubernetes - wget -O - https://bit.ly/2EepgOX | bash -s K8S_NAMESPACE DOCKER_HUB_USERNAME DOCKER_HUB_PASSWORD DOCKER_HUB_EMAIL SECRET_NAME
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
: ' | |
USAGE: | |
wget -O - <URL> | \ | |
bash -s <kubectl namespace> <secret name> <docker hub username> <docker hub password> <docker hub email> | |
' | |
NS=$1 | |
SNAME=$2 | |
DUSER=$3 | |
DPASS=$4 | |
DMAIL=$5 | |
DREGISTRY=https://index.docker.io/v1/ | |
kubectl -n $NS create secret docker-registry $SNAME \ | |
--docker-server=$DREGISTRY \ | |
--docker-username=$DUSER \ | |
--docker-password=$DPASS \ | |
--docker-email=$DMAIL | |
kubectl -n $NS get secret/$SNAME -o yaml > docker-registry-secret-$SNAME.yaml | |
kubectl -n $NS delete secret/$SNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment