Skip to content

Instantly share code, notes, and snippets.

@bkatiemills
Last active January 2, 2019 17:00
Show Gist options
  • Save bkatiemills/1ff5337965bb4aeec764dd6710a38116 to your computer and use it in GitHub Desktop.
Save bkatiemills/1ff5337965bb4aeec764dd6710a38116 to your computer and use it in GitHub Desktop.
# use your UCP username and password to acquire a UCP API auth token
AUTHTOKEN=$(curl -sk -d '{"username":"admin","password":"adminadmin"}' https://${UCP_FQDN}/auth/login | jq -r .auth_token)
# make your life easy by creating a curl alias that automatically uses your auth token:
alias ucp-api='curl -k -H "Authorization: Bearer $AUTHTOKEN"'
# download and initialize the client bundle authorizing action based on the permissions of the user who fetched the auth token above
mkdir ~/clientbundle ; cd ~/clientbundle
ucp-api https://${UCP_FQDN}/api/clientbundle -o bundle.zip
unzip bundle.zip
eval "$(<env.sh)"
# all docker and kubectl commands are now issued to your UCP cluster, instead of the local node. To undo this, run:
# unset DOCKER_TLS_VERIFY COMPOSE_TLS_VERSION DOCKER_CERT_PATH DOCKER_HOST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment