-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ed5057
commit 1ef1274
Showing
4 changed files
with
32 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
DIR="${HOME}/.kube" | ||
|
||
# if kubectl is in PATH / installed | ||
if which kubectl &>/dev/null; then | ||
[ -d "${DIR}" ] || mkdir -p "${DIR}" | ||
|
||
# Configure kubectl for local microk8s | ||
if ! [ -f "${DIR}/microk8s.config" ]; then | ||
# if microk8s is in PATH / installed | ||
if which microk8s &>/dev/null; then | ||
umask 0077 | ||
microk8s config | sed 's/\(user\|name\): admin/\1: microk8s-admin/' > "${DIR}/microk8s.config" | ||
fi | ||
fi | ||
|
||
# setup kubectl | ||
KUBECONFIG="$(find $DIR \( -name 'config' -o -name '*.config' \) \( -type f -o -type l \) -print0 | tr '\0' ':')" | ||
KUBECONFIG="${KUBECONFIG%:}" | ||
export KUBECONFIG | ||
fi |
This file contains 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
This file contains 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
This file contains 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