[zh] Resync task files (5)
This commit is contained in:
@@ -8,7 +8,6 @@ card:
|
||||
title: 在 macOS 系统上安装 kubectl
|
||||
---
|
||||
<!--
|
||||
---
|
||||
reviewers:
|
||||
- mikedanese
|
||||
title: Install and Set Up kubectl on macOS
|
||||
@@ -18,18 +17,17 @@ card:
|
||||
name: tasks
|
||||
weight: 20
|
||||
title: Install kubectl on macOS
|
||||
---
|
||||
-->
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
<!--
|
||||
You must use a kubectl version that is within one minor version difference of your cluster.
|
||||
For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master.
|
||||
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew latestVersion >}} client can communicate with v{{< skew prevMinorVersion >}}, v{{< skew latestVersion >}}, and v{{< skew nextMinorVersion >}} control planes.
|
||||
Using the latest version of kubectl helps avoid unforeseen issues.
|
||||
-->
|
||||
kubectl 版本和集群之间的差异必须在一个小版本号之内。
|
||||
例如:v1.2 版本的客户端只能与 v1.1、v1.2 和 v1.3 版本的集群一起工作。
|
||||
例如:v{{< skew latestVersion >}} 版本的客户端能与 v{{< skew prevMinorVersion >}}、
|
||||
v{{< skew latestVersion >}} 和 v{{< skew nextMinorVersion >}} 版本的控制面通信。
|
||||
用最新版本的 kubectl 有助于避免不可预见的问题。
|
||||
|
||||
<!--
|
||||
@@ -42,16 +40,16 @@ The following methods exist for installing kubectl on macOS:
|
||||
-->
|
||||
在 macOS 系统上安装 kubectl 有如下方法:
|
||||
|
||||
- [{{% heading "prerequisites" %}}](#{{% heading "prerequisites" %}})
|
||||
- [在 macOS 系统上安装 kubectl](#install-kubectl-on-macos)
|
||||
- [用 curl 在 macOS 系统上安装 kubectl](#install-kubectl-binary-with-curl-on-macos)
|
||||
- [用 Homebrew 在 macOS 系统上安装](#install-with-homebrew-on-macos)
|
||||
- [用 Macports 在 macOS 上安装](#install-with-macports-on-macos)
|
||||
- [作为谷歌云 SDK 的一部分,在 macOS 上安装](#install-on-macos-as-part-of-the-google-cloud-sdk)
|
||||
- [验证 kubectl 配置](#verify-kubectl-configuration)
|
||||
- [可选的 kubectl 配置](#optional-kubectl-configurations)
|
||||
- [启用 shell 自动补全功能](#enable-shell-autocompletion)
|
||||
- [{{% heading "whatsnext" %}}](#{{% heading "whatsnext" %}})
|
||||
<!--
|
||||
- [Install kubectl binary with curl on macOS](#install-kubectl-binary-with-curl-on-macos)
|
||||
- [Install with Homebrew on macOS](#install-with-homebrew-on-macos)
|
||||
- [Install with Macports on macOS](#install-with-macports-on-macos)
|
||||
- [Install on macOS as part of the Google Cloud SDK](#install-on-macos-as-part-of-the-google-cloud-sdk)
|
||||
-->
|
||||
- [用 curl 在 macOS 系统上安装 kubectl](#install-kubectl-binary-with-curl-on-macos)
|
||||
- [用 Homebrew 在 macOS 系统上安装](#install-with-homebrew-on-macos)
|
||||
- [用 Macports 在 macOS 上安装](#install-with-macports-on-macos)
|
||||
- [作为谷歌云 SDK 的一部分,在 macOS 上安装](#install-on-macos-as-part-of-the-google-cloud-sdk)
|
||||
|
||||
<!--
|
||||
### Install kubectl binary with curl on macOS {#install-kubectl-binary-with-curl-on-macos}
|
||||
@@ -63,40 +61,63 @@ The following methods exist for installing kubectl on macOS:
|
||||
-->
|
||||
1. 下载最新的发行版:
|
||||
|
||||
```bash
|
||||
{{< tabs name="download_binary_macos" >}}
|
||||
{{< tab name="Intel" codelang="bash" >}}
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
|
||||
```
|
||||
{{< /tab >}}
|
||||
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)` portion of the command with the specific version.
|
||||
|
||||
For example, to download version {{< param "fullversion" >}} on macOS, type:
|
||||
-->
|
||||
如果需要下载某个指定的版本,用该指定版本号替换掉命令的这个部分:`$(curl -L -s https://dl.k8s.io/release/stable.txt)`。
|
||||
例如:要在 macOS 系统中下载 {{< param "fullversion" >}} 版本,则输入:
|
||||
For example, to download version {{< param "fullversion" >}} on Intel macOS, type:
|
||||
|
||||
```bash
|
||||
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/amd64/kubectl
|
||||
curl -LO "https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/arm64/kubectl"
|
||||
```
|
||||
|
||||
-->
|
||||
如果需要下载某个指定的版本,用该指定版本号替换掉命令的这个部分:`$(curl -L -s https://dl.k8s.io/release/stable.txt)`。
|
||||
例如:要为 Intel macOS 系统下载 {{< param "fullversion" >}} 版本,则输入:
|
||||
|
||||
```bash
|
||||
curl -LO "https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/amd64/kubectl"
|
||||
```
|
||||
|
||||
<!--
|
||||
And for macOS on Apple Silicon, type:
|
||||
-->
|
||||
对于 Apple Silicon 版本的 macOS,输入:
|
||||
|
||||
```bash
|
||||
curl -LO "https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/arm64/kubectl"
|
||||
```
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
1. Validate the binary (optional)
|
||||
<!--
|
||||
1. Validate the binary (optional)
|
||||
|
||||
Download the kubectl checksum file:
|
||||
-->
|
||||
1. 验证可执行文件(可选操作)
|
||||
-->
|
||||
2. 验证可执行文件(可选操作)
|
||||
|
||||
下载 kubectl 的校验和文件:
|
||||
|
||||
```bash
|
||||
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256"
|
||||
```
|
||||
{{< tabs name="download_checksum_macos" >}}
|
||||
{{< tab name="Intel" codelang="bash" >}}
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256"
|
||||
{{< /tab >}}
|
||||
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256"
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
|
||||
<!--
|
||||
Validate the kubectl binary against the checksum file:
|
||||
Validate the kubectl binary against the checksum file:
|
||||
-->
|
||||
根据校验和文件,验证 kubectl:
|
||||
|
||||
@@ -129,29 +150,29 @@ The following methods exist for installing kubectl on macOS:
|
||||
下载的 kubectl 与校验和文件版本要相同。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
1. Make the kubectl binary executable.
|
||||
-->
|
||||
1. 将 kubectl 置为可执行文件:
|
||||
<!--
|
||||
1. Make the kubectl binary executable.
|
||||
-->
|
||||
3. 将 kubectl 置为可执行文件:
|
||||
|
||||
```bash
|
||||
chmod +x ./kubectl
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Move the kubectl binary to a file location on your system `PATH`.
|
||||
-->
|
||||
1. 将可执行文件 kubectl 移动到系统可寻址路径 `PATH` 内的一个位置:
|
||||
<!--
|
||||
1. Move the kubectl binary to a file location on your system `PATH`.
|
||||
-->
|
||||
4. 将可执行文件 kubectl 移动到系统可寻址路径 `PATH` 内的一个位置:
|
||||
|
||||
```bash
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
sudo chown root: /usr/local/bin/kubectl
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
1. 测试一下,确保你安装的是最新的版本:
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
5. 测试一下,确保你安装的是最新的版本:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
@@ -183,10 +204,10 @@ If you are on macOS and using [Homebrew](https://brew.sh/) package manager, you
|
||||
brew install kubernetes-cli
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
1. 测试一下,确保你安装的是最新的版本:
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
2. 测试一下,确保你安装的是最新的版本:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
@@ -212,10 +233,10 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
|
||||
sudo port install kubectl
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
1. 测试一下,确保你安装的是最新的版本:
|
||||
<!--
|
||||
1. Test to ensure the version you installed is up-to-date:
|
||||
-->
|
||||
2. 测试一下,确保你安装的是最新的版本:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
@@ -260,4 +281,5 @@ kubectl 为 Bash 和 Zsh 提供自动补全功能,这可以节省许多输入
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
{{< include "included/kubectl-whats-next.md" >}}
|
||||
{{< include "included/kubectl-whats-next.md" >}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user