From df7afa60b826d33ad07fa4b20b2baa5d43d2183c Mon Sep 17 00:00:00 2001 From: Tom Xing Date: Wed, 31 Aug 2016 05:30:17 +0800 Subject: [PATCH] Updated kubectl bash completion usage in the doc. (#1093) We have moved the shell script into `kubectl completion` command in [#23801](https://github.com/kubernetes/kubernetes/pull/23801), updated the bash completion usage in the doc. Fixes #1092 --- docs/getting-started-guides/gce.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/getting-started-guides/gce.md b/docs/getting-started-guides/gce.md index bc3d664909..d768c4db7f 100644 --- a/docs/getting-started-guides/gce.md +++ b/docs/getting-started-guides/gce.md @@ -95,17 +95,29 @@ potential issues with client/server version skew. You may find it useful to enable `kubectl` bash completion: -``` -$ source ./contrib/completions/bash/kubectl -``` +* If you're using kubectl with Kubernetes version 1.2 or earlier, you can source the kubectl completion script as follows:
+ ``` + $ source ./contrib/completions/bash/kubectl + ``` -**Note**: This will last for the duration of your bash session. If you want to make this permanent you need to add this line in your bash profile. +* If you're using kubectl with Kubernetes version 1.3, use the `kubectl completion` command as follows:
+ ``` + $ source <(kubectl completion bash) + ``` -Alternatively, on most linux distributions you can also move the completions file to your bash_completions.d like this: +**Note**: The above commands will last for the duration of your bash session. If you want to make this permanent you need to add corresponding command in your bash profile. -``` -$ cp ./contrib/completions/bash/kubectl /etc/bash_completion.d/ -``` +Alternatively, on most linux distributions you can also add a completions file to your bash_completions.d as follows: + +* For kubectl with Kubernetes v1.2 or earlier:
+ ``` + $ cp ./contrib/completions/bash/kubectl /etc/bash_completion.d/ + ``` + +* For kubectl with Kubernetes v1.3:
+ ``` + $ kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl + ``` but then you have to update it when you update kubectl.