You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zh-cn/docs/tasks/tools/install-kubectl-windows.md
+66-60Lines changed: 66 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ card:
7
7
weight: 20
8
8
title: Windows 安装 kubectl
9
9
---
10
-
<!--
10
+
<!--
11
11
reviewers:
12
12
- mikedanese
13
13
title: Install and Set Up kubectl on Windows
@@ -21,7 +21,7 @@ card:
21
21
22
22
## {{% heading "prerequisites" %}}
23
23
24
-
<!--
24
+
<!--
25
25
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew currentVersion >}} client can communicate with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}} control planes.
26
26
Using the latest compatible version of kubectl helps avoid unforeseen issues.
To find out the latest stable version (for example, for scripting), take a look at [https://dl.k8s.io/release/stable.txt](https://dl.k8s.io/release/stable.txt).
66
-
-->
67
69
{{< note >}}
70
+
<!--
71
+
To find out the latest stable version (for example, for scripting), take a look at [https://dl.k8s.io/release/stable.txt](https://dl.k8s.io/release/stable.txt).
1. Append or prepend the `kubectl` binary folder to your `PATH` environment variable.
113
+
<!--
114
+
1. Append or prepend the `kubectl` binary folder to your `PATH` environment variable.
110
115
111
-
1. Test to ensure the version of `kubectl` is the same as downloaded:
112
-
Or use this for detailed view of version:
113
-
-->
114
-
1. 将 `kubectl` 二进制文件夹追加或插入到你的 `PATH` 环境变量中。
116
+
1. Test to ensure the version of `kubectl` is the same as downloaded:
117
+
-->
115
118
116
-
1. 测试一下,确保此 `kubectl` 的版本和期望版本一致:
119
+
3. 将 `kubectl` 二进制文件夹追加或插入到你的 `PATH` 环境变量中。
120
+
121
+
4. 测试一下,确保此 `kubectl` 的版本和期望版本一致:
117
122
118
123
```cmd
119
124
kubectl version --client
120
125
```
121
126
或者使用下面命令来查看版本的详细信息:
127
+
122
128
```cmd
123
129
kubectl version --client --output=yaml
124
130
```
125
131
126
-
127
132
<!--
128
133
[Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/#kubernetes) adds its own version of `kubectl` to `PATH`.
129
134
If you have installed Docker Desktop before, you may need to place your `PATH` entry before the one added by the Docker Desktop installer or remove the Docker Desktop's `kubectl`.
@@ -135,12 +140,12 @@ If you have installed Docker Desktop before, you may need to place your `PATH` e
135
140
或者直接删掉 Docker Desktop 的 `kubectl`。
136
141
{{< /note >}}
137
142
138
-
<!--
143
+
<!--
139
144
### Install on Windows using Chocolatey or Scoop
140
145
-->
141
146
### 在 Windows 上用 Chocolatey 或 Scoop 安装 {#install-on-windows-using-chocolatey-or-scoop}
142
147
143
-
<!--
148
+
<!--
144
149
1. To install kubectl on Windows you can use either [Chocolatey](https://chocolatey.org) package manager or [Scoop](https://scoop.sh) command-line installer.
145
150
-->
146
151
1. 要在 Windows 上安装 kubectl,你可以使用包管理器 [Chocolatey](https://chocolatey.org)
@@ -159,49 +164,47 @@ If you have installed Docker Desktop before, you may need to place your `PATH` e
159
164
{{% /tab %}}
160
165
{{< /tabs >}}
161
166
162
-
<!--
163
-
1. Test to ensure the version you installed is up-to-date:
164
-
-->
167
+
168
+
<!--
169
+
1. Test to ensure the version you installed is up-to-date:
170
+
-->
165
171
2. 测试一下,确保安装的是最新版本:
166
172
167
173
```powershell
168
174
kubectl version --client
169
175
```
170
176
171
-
<!--
172
-
1. Navigate to your home directory:
173
-
-->
177
+
<!--
178
+
1. Navigate to your home directory:
179
+
-->
174
180
3. 导航到你的 home 目录:
175
181
176
-
<!--
177
-
# If you're using cmd.exe, run: cd %USERPROFILE%
178
-
-->
179
182
```powershell
180
183
# 当你用 cmd.exe 时,则运行: cd %USERPROFILE%
181
184
cd ~
182
185
```
183
186
184
-
<!--
185
-
1. Create the `.kube` directory:
186
-
-->
187
+
<!--
188
+
1. Create the `.kube` directory:
189
+
-->
187
190
4. 创建目录 `.kube`:
188
191
189
192
```powershell
190
193
mkdir .kube
191
194
```
192
195
193
-
<!--
194
-
1. Change to the `.kube` directory you just created:
195
-
-->
196
+
<!--
197
+
1. Change to the `.kube` directory you just created:
198
+
-->
196
199
5. 切换到新创建的目录 `.kube`
197
200
198
201
```powershell
199
202
cd .kube
200
203
```
201
204
202
-
<!--
203
-
1. Configure kubectl to use a remote Kubernetes cluster:
204
-
-->
205
+
<!--
206
+
1. Configure kubectl to use a remote Kubernetes cluster:
0 commit comments