Skip to content

Instantly share code, notes, and snippets.

@Efrat19
Created February 27, 2020 22:08
Show Gist options
  • Save Efrat19/324b8920697d3b2614be73cdd9a91f11 to your computer and use it in GitHub Desktop.
Save Efrat19/324b8920697d3b2614be73cdd9a91f11 to your computer and use it in GitHub Desktop.
blog snippets
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