Skip to content

Commit df7afa6

Browse files
xingzhoudevin-donnelly
authored andcommitted
Updated kubectl bash completion usage in the doc. (kubernetes#1093)
We have moved the shell script into `kubectl completion` command in [kubernetes#23801](kubernetes/kubernetes#23801), updated the bash completion usage in the doc. Fixes kubernetes#1092
1 parent 45e8948 commit df7afa6

File tree

1 file changed

+20
-8
lines changed
  • docs/getting-started-guides

1 file changed

+20
-8
lines changed

docs/getting-started-guides/gce.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,29 @@ potential issues with client/server version skew.
9595

9696
You may find it useful to enable `kubectl` bash completion:
9797

98-
```
99-
$ source ./contrib/completions/bash/kubectl
100-
```
98+
* If you're using kubectl with Kubernetes version 1.2 or earlier, you can source the kubectl completion script as follows:<br>
99+
```
100+
$ source ./contrib/completions/bash/kubectl
101+
```
101102

102-
**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.
103+
* If you're using kubectl with Kubernetes version 1.3, use the `kubectl completion` command as follows:<br>
104+
```
105+
$ source <(kubectl completion bash)
106+
```
103107

104-
Alternatively, on most linux distributions you can also move the completions file to your bash_completions.d like this:
108+
**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.
105109

106-
```
107-
$ cp ./contrib/completions/bash/kubectl /etc/bash_completion.d/
108-
```
110+
Alternatively, on most linux distributions you can also add a completions file to your bash_completions.d as follows:
111+
112+
* For kubectl with Kubernetes v1.2 or earlier:<br>
113+
```
114+
$ cp ./contrib/completions/bash/kubectl /etc/bash_completion.d/
115+
```
116+
117+
* For kubectl with Kubernetes v1.3:<br>
118+
```
119+
$ kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl
120+
```
109121

110122
but then you have to update it when you update kubectl.
111123

0 commit comments

Comments
 (0)