Last active
March 29, 2019 18:06
-
-
Save carlessanagustin/f734e22a41648d46660bdfb4f1511680 to your computer and use it in GitHub Desktop.
Configure k8s for local user - wget -O - https://goo.gl/QY8HnC | bash -s USERNAME
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 | |
: ' | |
From root or sudoer user... | |
USAGE: | |
wget -O - URL | bash -s USERNAME | |
' | |
USERNAME=$1 | |
LOCATION=/home/$USERNAME | |
# kube config | |
sudo mkdir -p $LOCATION/.kube | |
sudo cp -i /etc/kubernetes/admin.conf $LOCATION/.kube/config | |
sudo chown -R $USERNAME:$USERNAME $LOCATION/.kube | |
# BASH | |
# source <(kubectl completion bash) | |
sudo sh -c 'echo "source <(kubectl completion bash)" >> $LOCATION/.bashrc' | |
sudo chown $USERNAME:$USERNAME $LOCATION/.bashrc | |
# ZSH | |
# source <(kubectl completion zsh) | |
sudo sh -c 'echo "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> $LOCATION/.zshrc' | |
sudo chown $USERNAME:$USERNAME $LOCATION/.zshrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment