Created
February 27, 2020 22:08
-
-
Save Efrat19/324b8920697d3b2614be73cdd9a91f11 to your computer and use it in GitHub Desktop.
blog snippets
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
export CLUSTER="$(kubectl config view -ojson | jq -r --arg CTX $(kubectl config current-context) '.contexts | .[] | select(.name == $CTX) | .context.cluster | split("/") | .[length-1]')" | |
export REGION=$(aws configure get region) | |
export OIDC=$(aws eks describe-cluster --name ${CLUSTER} --query cluster.identity.oidc | jq -r '.issuer | split("/") | .[length-1]') | |
export ACCOUNT=$(aws sts get-caller-identity --query Account --output text) | |
echo "cluster $CLUSTER in region $REGION and account number ${ACCOUNT} has OIDC token: ${OIDC}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment