Last active
November 22, 2019 13:30
-
-
Save valbeat/b43020e0944bb0e5afec5e6c4386e799 to your computer and use it in GitHub Desktop.
GKEの快適なオペレーション ref: https://qiita.com/kajitack/items/5af6a838bff34724a639
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
# プロジェクトのリストを表示 | |
$ gcloud projects list | |
# プロジェクトの切り替え | |
$ gcloud config set project PROJECT_ID |
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
function _gcloud_change_project() { | |
local proj=$(gcloud projects list | fzf --header-lines=1 | awk '{print $1}') | |
if [ -n $proj ]; then | |
gcloud config set project $proj | |
return $? | |
fi | |
} | |
alias gcp=_gcloud_change_project |
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
$ gcloud config get-value project |
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
function _gcloud_change_account() { | |
local account=$(gcloud auth list --format="value(account)" | fzf | awk '{print $1}') | |
if [[ -n $account ]]; then | |
gcloud config set account $account | |
return $? | |
fi | |
} | |
alias gca=_gcloud_change_account |
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
# contextのリストを表示 | |
$ kubectl config get-contexts | |
# contextを切り替え | |
$ kubectl config use-context CONTEXT |
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
# bash | |
source <(kubectl completion bash) | |
# zsh | |
source <(kubectl completion zsh) |
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
if [ $commands[kubectl] ]; then | |
source <(kubectl completion zsh) | |
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
$ kubectl get pod | |
$ kubectl get po | |
$ kubectl get deployment | |
$ kubectl get deploy | |
$ kubectl get service | |
$ kubectl get svc |
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
alias k=kubectl | |
alias kx=kubectx | |
alias kn=kubens |
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
if [ $commands[stern] ]; then | |
source <(stern --completion=zsh) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment