Skip to content

Commit de98cc7

Browse files
authored
[ja] Translate content/ja/docs/tasks/tools/install-kubectl-windows.md (#45486)
* [ja] Translate content/ja/docs/tasks/tools/install-kubectl-windows.md * remove revieweres added a link to the minikube installation website del command update
1 parent e620690 commit de98cc7

12 files changed

+1202
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Tools Included"
3+
description: "メインのkubectl-installs-*.mdページに含まれるスニペット。"
4+
headless: true
5+
toc_hide: true
6+
_build:
7+
list: never
8+
render: never
9+
publishResources: false
10+
---
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "kubectl-convertの概要"
3+
description: >-
4+
Kubernetes APIのあるバージョンから別のバージョンにマニフェストを変換することができるkubectlプラグイン。
5+
headless: true
6+
_build:
7+
list: never
8+
render: never
9+
publishResources: false
10+
---
11+
12+
異なるAPIバージョン間でマニフェストを変換できる、Kubernetesコマンドラインツール`kubectl`のプラグインです。
13+
これは特に、新しいKubernetesのリリースで、非推奨ではないAPIバージョンにマニフェストを移行する場合に役に立ちます。
14+
詳細については[非推奨ではないAPIへの移行](/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)を参照してください。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "次の項目"
3+
description: "kubectlをインストールした後の次の項目。"
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
* [Minikubeをインストールする](https://minikube.sigs.k8s.io/docs/start/)
12+
* クラスターの作成に関する詳細を[スタートガイド](/ja/docs/setup/)で確認する。
13+
* [アプリケーションを起動して公開する方法を学ぶ。](/ja/docs/tasks/access-application-cluster/service-access-application-cluster/)
14+
* あなたが作成していないクラスターにアクセスする必要がある場合は、[クラスターアクセスドキュメントの共有](/ja/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)を参照してください。
15+
* [kubectlリファレンスドキュメント](/docs/reference/kubectl/kubectl/)を参照する
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: "bash auto-completion on Linux"
3+
description: "Some optional configuration for bash auto-completion on Linux."
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
### Introduction
12+
13+
The kubectl completion script for Bash can be generated with the command `kubectl completion bash`.
14+
Sourcing the completion script in your shell enables kubectl autocompletion.
15+
16+
However, the completion script depends on
17+
[**bash-completion**](https://github.com/scop/bash-completion),
18+
which means that you have to install this software first
19+
(you can test if you have bash-completion already installed by running `type _init_completion`).
20+
21+
### Install bash-completion
22+
23+
bash-completion is provided by many package managers
24+
(see [here](https://github.com/scop/bash-completion#installation)).
25+
You can install it with `apt-get install bash-completion` or `yum install bash-completion`, etc.
26+
27+
The above commands create `/usr/share/bash-completion/bash_completion`,
28+
which is the main script of bash-completion. Depending on your package manager,
29+
you have to manually source this file in your `~/.bashrc` file.
30+
31+
To find out, reload your shell and run `type _init_completion`.
32+
If the command succeeds, you're already set, otherwise add the following to your `~/.bashrc` file:
33+
34+
```bash
35+
source /usr/share/bash-completion/bash_completion
36+
```
37+
38+
Reload your shell and verify that bash-completion is correctly installed by typing `type _init_completion`.
39+
40+
### Enable kubectl autocompletion
41+
42+
#### Bash
43+
44+
You now need to ensure that the kubectl completion script gets sourced in all
45+
your shell sessions. There are two ways in which you can do this:
46+
47+
{{< tabs name="kubectl_bash_autocompletion" >}}
48+
{{< tab name="User" codelang="bash" >}}
49+
echo 'source <(kubectl completion bash)' >>~/.bashrc
50+
{{< /tab >}}
51+
{{< tab name="System" codelang="bash" >}}
52+
kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
53+
sudo chmod a+r /etc/bash_completion.d/kubectl
54+
{{< /tab >}}
55+
{{< /tabs >}}
56+
57+
If you have an alias for kubectl, you can extend shell completion to work with that alias:
58+
59+
```bash
60+
echo 'alias k=kubectl' >>~/.bashrc
61+
echo 'complete -o default -F __start_kubectl k' >>~/.bashrc
62+
```
63+
64+
{{< note >}}
65+
bash-completion sources all completion scripts in `/etc/bash_completion.d`.
66+
{{< /note >}}
67+
68+
Both approaches are equivalent. After reloading your shell, kubectl autocompletion should be working.
69+
To enable bash autocompletion in current session of shell, source the ~/.bashrc file:
70+
71+
```bash
72+
source ~/.bashrc
73+
```
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: "bash auto-completion on macOS"
3+
description: "Some optional configuration for bash auto-completion on macOS."
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
### Introduction
12+
13+
The kubectl completion script for Bash can be generated with `kubectl completion bash`.
14+
Sourcing this script in your shell enables kubectl completion.
15+
16+
However, the kubectl completion script depends on
17+
[**bash-completion**](https://github.com/scop/bash-completion) which you thus have to previously install.
18+
19+
{{< 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).
28+
{{< /warning >}}
29+
30+
### Upgrade Bash
31+
32+
The instructions here assume you use Bash 4.1+. You can check your Bash's version by running:
33+
34+
```bash
35+
echo $BASH_VERSION
36+
```
37+
38+
If it is too old, you can install/upgrade it using Homebrew:
39+
40+
```bash
41+
brew install bash
42+
```
43+
44+
Reload your shell and verify that the desired version is being used:
45+
46+
```bash
47+
echo $BASH_VERSION $SHELL
48+
```
49+
50+
Homebrew usually installs it at `/usr/local/bin/bash`.
51+
52+
### Install bash-completion
53+
54+
{{< 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).
58+
{{< /note >}}
59+
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:
62+
63+
```bash
64+
brew install bash-completion@2
65+
```
66+
67+
As stated in the output of this command, add the following to your `~/.bash_profile` file:
68+
69+
```bash
70+
brew_etc="$(brew --prefix)/etc" && [[ -r "${brew_etc}/profile.d/bash_completion.sh" ]] && . "${brew_etc}/profile.d/bash_completion.sh"
71+
```
72+
73+
Reload your shell and verify that bash-completion v2 is correctly installed with `type _init_completion`.
74+
75+
### Enable kubectl autocompletion
76+
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:
79+
80+
- Source the completion script in your `~/.bash_profile` file:
81+
82+
```bash
83+
echo 'source <(kubectl completion bash)' >>~/.bash_profile
84+
```
85+
86+
- Add the completion script to the `/usr/local/etc/bash_completion.d` directory:
87+
88+
```bash
89+
kubectl completion bash >/usr/local/etc/bash_completion.d/kubectl
90+
```
91+
92+
- If you have an alias for kubectl, you can extend shell completion to work with that alias:
93+
94+
```bash
95+
echo 'alias k=kubectl' >>~/.bash_profile
96+
echo 'complete -o default -F __start_kubectl k' >>~/.bash_profile
97+
```
98+
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.
103+
104+
{{< 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.
107+
{{< /note >}}
108+
109+
In any case, after reloading your shell, kubectl completion should be working.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "fish auto-completion"
3+
description: "Optional configuration to enable fish shell auto-completion."
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
{{< note >}}
12+
Autocomplete for Fish requires kubectl 1.23 or later.
13+
{{< /note >}}
14+
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.
16+
17+
To do so in all your shell sessions, add the following line to your `~/.config/fish/config.fish` file:
18+
19+
```shell
20+
kubectl completion fish | source
21+
```
22+
23+
After reloading your shell, kubectl autocompletion should be working.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "PowerShellの自動補完"
3+
description: "PowerShellの自動補完に対するいくつかの補助的な設定。"
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
PowerShellにおけるkubectlの補完スクリプトは`kubectl completion powershell`コマンドで生成できます。
12+
13+
すべてのシェルセッションでこれを行うには、次の行を`$PROFILE`ファイルに追加します。
14+
15+
```powershell
16+
kubectl completion powershell | Out-String | Invoke-Expression
17+
```
18+
19+
このコマンドは、PowerShellを起動する度に自動補完のスクリプトを再生成します。
20+
生成されたスクリプトを直接`$PROFILE`ファイルに追加することもできます。
21+
22+
生成されたスクリプトを`$PROFILE`ファイルに追加するためには、PowerShellのプロンプトで次の行を実行します:
23+
24+
```powershell
25+
kubectl completion powershell >> $PROFILE
26+
```
27+
28+
シェルをリロードした後、kubectlの自動補完が機能します。
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "zsh auto-completion"
3+
description: "Some optional configuration for zsh auto-completion."
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
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.
12+
13+
To do so in all your shell sessions, add the following to your `~/.zshrc` file:
14+
15+
```zsh
16+
source <(kubectl completion zsh)
17+
```
18+
19+
If you have an alias for kubectl, kubectl autocompletion will automatically work with it.
20+
21+
After reloading your shell, kubectl autocompletion should be working.
22+
23+
If you get an error like `2: command not found: compdef`, then add the following to the beginning of your `~/.zshrc` file:
24+
25+
```zsh
26+
autoload -Uz compinit
27+
compinit
28+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "kubectlの設定を検証する"
3+
description: "kubectlを検証する方法。"
4+
headless: true
5+
_build:
6+
list: never
7+
render: never
8+
publishResources: false
9+
---
10+
11+
kubectlがKubernetesクラスターを探索し接続するために、[kubeconfigファイル](/ja/docs/concepts/configuration/organize-cluster-access-kubeconfig/)が必要です。
12+
これは、[kube-up.sh](https://github.com/kubernetes/kubernetes/blob/master/cluster/kube-up.sh)によりクラスターを作成した際や、Minikubeクラスターを正常にデプロイした際に自動生成されます。
13+
デフォルトでは、kubectlの設定は`~/.kube/config`に格納されています。
14+
15+
クラスターの状態を取得し、kubectlが適切に設定されていることを確認してください:
16+
17+
```shell
18+
kubectl cluster-info
19+
```
20+
21+
URLのレスポンスが表示されている場合は、kubectlはクラスターに接続するよう正しく設定されています。
22+
23+
以下のようなメッセージが表示されている場合は、kubectlは正しく設定されていないか、Kubernetesクラスターに接続できていません。
24+
25+
```
26+
The connection to the server <server-name:port> was refused - did you specify the right host or port?
27+
```
28+
29+
たとえば、ラップトップ上(ローカル環境)でKubernetesクラスターを起動するような場合、[Minikube](https://minikube.sigs.k8s.io/docs/start/)などのツールを最初にインストールしてから、上記のコマンドを再実行する必要があります。
30+
31+
kubectl cluster-infoがURLレスポンスを返したにもかかわらずクラスターにアクセスできない場合は、次のコマンドで設定が正しいことを確認してください:
32+
33+
```shell
34+
kubectl cluster-info dump
35+
```
36+
37+
### エラーメッセージ'No Auth Provider Found'のトラブルシューティング{#no-auth-provider-found}
38+
39+
Kubernetes 1.26にて、kubectlは以下のクラウドプロバイダーが提供するマネージドKubernetesのビルトイン認証を削除しました。
40+
これらのプロバイダーは、クラウド固有の認証を提供するkubectlプラグインをリリースしています。
41+
手順については以下のプロバイダーのドキュメントを参照してください:
42+
43+
* 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)
45+
46+
(この変更とは関係なく、他の理由で同じエラーメッセージが表示される可能性もあります。)

0 commit comments

Comments
 (0)