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 | |
# ref: https://gist.github.com/ericchiang/d2a838ddad3f44436ae001a342e1001e | |
# thanks to ericchiang for the initial gist, just tweaked for macos or linux and dynamic file naming. | |
# Creates kubeconfig files using tokens. | |
# Copy these files to where the ci or cd processes/envs run kubectl commands--i.e.: jenkins, etc. | |
# | |
# Usage ./k8s-service-account-kubeconfig.sh ( namespace ) ( service account name ) | |
# i.e.: k8-sevice-account-kubeconfig.sh ci ci | |
# i.e.: k8-sevice-account-kubeconfig.sh cd cd | |
# this is for the naming the kubeconfig file naming us "kubeconfig-$KUBE_USER" |