Skip to content

Commit f5180c7

Browse files
authored
Merge pull request #45854 from levi106/macos-kubectl
[ja] Translate content/ja/docs/tasks/tools/install-kubectl-macos.md
2 parents e137b04 + 453e919 commit f5180c7

File tree

5 files changed

+126
-133
lines changed

5 files changed

+126
-133
lines changed
Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,103 @@
11
---
2-
title: "bash auto-completion on macOS"
3-
description: "Some optional configuration for bash auto-completion on macOS."
2+
title: "macOS上でのbashの自動補完"
3+
description: "macOS上でのbashの自動補完に対するいくつかの補助的な設定。"
44
headless: true
55
_build:
66
list: never
77
render: never
88
publishResources: false
99
---
1010

11-
### Introduction
11+
### はじめに
1212

13-
The kubectl completion script for Bash can be generated with `kubectl completion bash`.
14-
Sourcing this script in your shell enables kubectl completion.
13+
Bashにおけるkubectlの補完スクリプトは`kubectl completion bash`コマンドで生成できます。
14+
シェル内で補完スクリプトをsourceすることでkubectlの自動補完が有効になります。
1515

16-
However, the kubectl completion script depends on
17-
[**bash-completion**](https://github.com/scop/bash-completion) which you thus have to previously install.
16+
ただし、補完スクリプトは[**bash-completion**](https://github.com/scop/bash-completion)に依存しているため、事前にインストールしておく必要があります。
1817

1918
{{< warning>}}
20-
There are two versions of bash-completion, v1 and v2. V1 is for Bash 3.2
21-
(which is the default on macOS), and v2 is for Bash 4.1+. The kubectl completion
22-
script **doesn't work** correctly with bash-completion v1 and Bash 3.2.
23-
It requires **bash-completion v2** and **Bash 4.1+**. Thus, to be able to
24-
correctly use kubectl completion on macOS, you have to install and use
25-
Bash 4.1+ ([*instructions*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba)).
26-
The following instructions assume that you use Bash 4.1+
27-
(that is, any Bash version of 4.1 or newer).
19+
bash-completionにはv1とv2の2つのバージョンがあります。
20+
v1はBash 3.2(macOSのデフォルト)用で、v2はBash 4.1以降向けです。
21+
kubectlの補完スクリプトはbash-completionのv1とBash 3.2では正しく**動作しません**
22+
**bash-completion v2****Bash 4.1以降**が必要になります。
23+
したがって、macOSで正常にkubectlの補完を使用するには、Bash 4.1以降をインストールする必要があります([*手順*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba))。
24+
以下の手順では、Bash4.1以降(Bashのバージョンが4.1またはそれより新しいことを指します)を使用することを前提とします。
2825
{{< /warning >}}
2926

30-
### Upgrade Bash
27+
### Bashのアップグレード
3128

32-
The instructions here assume you use Bash 4.1+. You can check your Bash's version by running:
29+
ここではBash 4.1以降の使用を前提としています。
30+
Bashのバージョンは下記のコマンドで調べることができます:
3331

3432
```bash
3533
echo $BASH_VERSION
3634
```
3735

38-
If it is too old, you can install/upgrade it using Homebrew:
36+
バージョンが古い場合、Homebrewを使用してインストールもしくはアップグレードできます:
3937

4038
```bash
4139
brew install bash
4240
```
4341

44-
Reload your shell and verify that the desired version is being used:
42+
シェルをリロードし、希望するバージョンを使用していることを確認してください:
4543

4644
```bash
4745
echo $BASH_VERSION $SHELL
4846
```
4947

50-
Homebrew usually installs it at `/usr/local/bin/bash`.
48+
Homebrewは通常、`/usr/local/bin/bash`にインストールします。
5149

52-
### Install bash-completion
50+
### bash-completionをインストールする
5351

5452
{{< note >}}
55-
As mentioned, these instructions assume you use Bash 4.1+, which means you will
56-
install bash-completion v2 (in contrast to Bash 3.2 and bash-completion v1,
57-
in which case kubectl completion won't work).
53+
前述のとおり、この手順ではBash 4.1以降であることが前提のため、bash-completion v2をインストールすることになります(これとは逆に、Bash 3.2およびbash-completion v1の場合ではkubectlの補完は動作しません)。
5854
{{< /note >}}
5955

60-
You can test if you have bash-completion v2 already installed with `type _init_completion`.
61-
If not, you can install it with Homebrew:
56+
57+
`type _init_completion`を実行することで、bash-completionがすでにインストールされていることを確認できます。
58+
ない場合は、Homebrewを使用してインストールすることができます:
6259

6360
```bash
6461
brew install bash-completion@2
6562
```
6663

67-
As stated in the output of this command, add the following to your `~/.bash_profile` file:
64+
このコマンドの出力で示されたように、`~/.bash_profile`に以下を追記してください:
6865

6966
```bash
7067
brew_etc="$(brew --prefix)/etc" && [[ -r "${brew_etc}/profile.d/bash_completion.sh" ]] && . "${brew_etc}/profile.d/bash_completion.sh"
7168
```
7269

73-
Reload your shell and verify that bash-completion v2 is correctly installed with `type _init_completion`.
70+
シェルをリロードし、`type _init_completion`を実行してbash-completion v2が正しくインストールされていることを検証してください。
7471

75-
### Enable kubectl autocompletion
72+
### kubectlの自動補完を有効にする
7673

77-
You now have to ensure that the kubectl completion script gets sourced in all
78-
your shell sessions. There are multiple ways to achieve this:
74+
すべてのシェルセッションにてkubectlの補完スクリプトをsourceできるようにしなければなりません。
75+
これを行うには複数の方法があります:
7976

80-
- Source the completion script in your `~/.bash_profile` file:
77+
- 補完スクリプトを`~/.bash_profile`内でsourceする:
8178

8279
```bash
8380
echo 'source <(kubectl completion bash)' >>~/.bash_profile
8481
```
8582

86-
- Add the completion script to the `/usr/local/etc/bash_completion.d` directory:
83+
- 補完スクリプトを`/usr/local/etc/bash_completion.d`ディレクトリに追加する:
8784

8885
```bash
8986
kubectl completion bash >/usr/local/etc/bash_completion.d/kubectl
9087
```
9188

92-
- If you have an alias for kubectl, you can extend shell completion to work with that alias:
89+
- kubectlにエイリアスを張っている場合は、エイリアスでも動作するようにシェルの補完を拡張することができます:
9390

9491
```bash
9592
echo 'alias k=kubectl' >>~/.bash_profile
9693
echo 'complete -o default -F __start_kubectl k' >>~/.bash_profile
9794
```
9895

99-
- If you installed kubectl with Homebrew (as explained
100-
[here](/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos)),
101-
then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`.
102-
In that case, you don't need to do anything.
96+
- kubectlをHomebrewでインストールした場合([前述](/ja/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos)の通り)、kubectlの補完スクリプトはすでに`/usr/local/etc/bash_completion.d/kubectl`に格納されているでしょうか。
97+
この場合、なにも操作する必要はありません。
10398

10499
{{< note >}}
105-
The Homebrew installation of bash-completion v2 sources all the files in the
106-
`BASH_COMPLETION_COMPAT_DIR` directory, that's why the latter two methods work.
100+
Homebrewでインストールしたbash-completion v2は`BASH_COMPLETION_COMPAT_DIR`ディレクトリ内のすべてのファイルをsourceするため、後者の2つの方法が機能します。
107101
{{< /note >}}
108102

109-
In any case, after reloading your shell, kubectl completion should be working.
103+
どの場合でも、シェルをリロードしたあとに、kubectlの自動補完が機能するはずです。
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "fish auto-completion"
3-
description: "Optional configuration to enable fish shell auto-completion."
2+
title: "fishの自動補完"
3+
description: "fishシェルの自動補完を有効にする補助的な設定。"
44
headless: true
55
_build:
66
list: never
@@ -9,15 +9,16 @@ _build:
99
---
1010

1111
{{< note >}}
12-
Autocomplete for Fish requires kubectl 1.23 or later.
12+
Fishに対する自動補完はkubectl 1.23以降が必要です。
1313
{{< /note >}}
1414

15-
The kubectl completion script for Fish can be generated with the command `kubectl completion fish`. Sourcing the completion script in your shell enables kubectl autocompletion.
15+
Fishにおけるkubectlの補完スクリプトは`kubectl completion fish`コマンドで生成できます。
16+
シェル内で補完スクリプトをsourceすることでkubectlの自動補完が有効になります。
1617

17-
To do so in all your shell sessions, add the following line to your `~/.config/fish/config.fish` file:
18+
すべてのシェルセッションで使用するには、`~/.config/fish/config.fish`に以下を追記してください:
1819

1920
```shell
2021
kubectl completion fish | source
2122
```
2223

23-
After reloading your shell, kubectl autocompletion should be working.
24+
シェルをリロードしたあとに、kubectlの自動補完が機能するはずです。

content/ja/docs/tasks/tools/included/optional-kubectl-configs-zsh.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
2-
title: "zsh auto-completion"
3-
description: "Some optional configuration for zsh auto-completion."
2+
title: "zshの自動補完"
3+
description: "zshの自動補完に対するいくつかの補助的な設定。"
44
headless: true
55
_build:
66
list: never
77
render: never
88
publishResources: false
99
---
1010

11-
The kubectl completion script for Zsh can be generated with the command `kubectl completion zsh`. Sourcing the completion script in your shell enables kubectl autocompletion.
11+
Zshにおけるkubectlの補完スクリプトは`kubectl completion zsh`コマンドで生成できます。
12+
シェル内で補完スクリプトをsourceすることでkubectlの自動補完が有効になります。
1213

13-
To do so in all your shell sessions, add the following to your `~/.zshrc` file:
14+
すべてのシェルセッションで使用するには、`~/.zshrc`に以下を追記してください:
1415

1516
```zsh
1617
source <(kubectl completion zsh)
1718
```
1819

19-
If you have an alias for kubectl, kubectl autocompletion will automatically work with it.
20+
kubectlにエイリアスを張っている場合でも、kubectlの自動補完は自動的に機能します。
2021

21-
After reloading your shell, kubectl autocompletion should be working.
22+
シェルをリロードしたあとに、kubectlの自動補完が機能するはずです。
2223

23-
If you get an error like `2: command not found: compdef`, then add the following to the beginning of your `~/.zshrc` file:
24+
`2: command not found: compdef`のようなエラーが出力された場合は、以下を`~/.zshrc`の先頭に追記してください:
2425

2526
```zsh
2627
autoload -Uz compinit

content/ja/docs/tasks/tools/included/verify-kubectl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The connection to the server <server-name:port> was refused - did you specify th
2828

2929
たとえば、ラップトップ上(ローカル環境)でKubernetesクラスターを起動するような場合、[Minikube](https://minikube.sigs.k8s.io/docs/start/)などのツールを最初にインストールしてから、上記のコマンドを再実行する必要があります。
3030

31-
kubectl cluster-infoがURLレスポンスを返したにもかかわらずクラスターにアクセスできない場合は、次のコマンドで設定が正しいことを確認してください:
31+
`kubectl cluster-info`がURLレスポンスを返したにもかかわらずクラスターにアクセスできない場合は、次のコマンドで設定が正しいことを確認してください:
3232

3333
```shell
3434
kubectl cluster-info dump
@@ -41,6 +41,6 @@ Kubernetes 1.26にて、kubectlは以下のクラウドプロバイダーが提
4141
手順については以下のプロバイダーのドキュメントを参照してください:
4242

4343
* Azure AKS: [kubelogin plugin](https://azure.github.io/kubelogin/)
44-
* Google Kubernetes Engine: [gke-gcloud-auth-plugin](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin)
44+
* Google Kubernetes Engine: [gke-gcloud-auth-plugin](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl?hl=ja#install_plugin)
4545

4646
(この変更とは関係なく、他の理由で同じエラーメッセージが表示される可能性もあります。)

0 commit comments

Comments
 (0)