Skip to content

Instantly share code, notes, and snippets.

View cmcconnell1's full-sized avatar

Chris McConnell cmcconnell1

View GitHub Profile
@cmcconnell1
cmcconnell1 / k8s-service-account-kubeconfig.sh
Last active August 21, 2019 00:58 — forked from ericchiang/k8s-service-account-kubeconfig.sh
dynamic generation of kubeconfig files for ci and cd macos and linux
#!/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"