Created
July 9, 2018 22:24
-
-
Save fabiogomezdiaz/b5afafea1ce845d413afc6cd5f5c16ea to your computer and use it in GitHub Desktop.
Kubernetes: Delete Service Account
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
#!/bin/bash | |
#set -e | |
#set -o pipefail | |
# Add user to k8s using service account, no RBAC (must create RBAC after this script) | |
if [[ -z "$1" ]] || [[ -z "$2" ]]; then | |
echo "usage: $0 <service_account_name> <namespace>" | |
exit 1 | |
fi | |
SERVICE_ACCOUNT_NAME=$1 | |
NAMESPACE="$2" | |
kubectl --namespace ${NAMESPACE} delete sa ${SERVICE_ACCOUNT_NAME}; | |
kubectl --namespace ${NAMESPACE} delete clusterrolebinding ${SERVICE_ACCOUNT_NAME}-binding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment