[zh] Remove dual-hosted info about kops and kubespray
parent
f89116df93
commit
b90aa9e75e
|
@ -589,13 +589,12 @@ needs of your cluster's workloads:
|
|||
[API 服务器](/zh-cn/docs/setup/production-environment/tools/kubeadm/ha-topology/)这些功能组件配置高可用能力。
|
||||
<!--
|
||||
- Choose from [kubeadm](/docs/setup/production-environment/tools/kubeadm/),
|
||||
[kops](/docs/setup/production-environment/tools/kops/) or
|
||||
[Kubespray](/docs/setup/production-environment/tools/kubespray/)
|
||||
deployment methods.
|
||||
[kops](https://kops.sigs.k8s.io/) or
|
||||
[Kubespray](https://kubespray.io/) deployment methods.
|
||||
-->
|
||||
- 选择使用 [kubeadm](/zh-cn/docs/setup/production-environment/tools/kubeadm/)、
|
||||
[kops](/zh-cn/docs/setup/production-environment/tools/kops/) 或
|
||||
[Kubespray](/zh-cn/docs/setup/production-environment/tools/kubespray/) 作为部署方法。
|
||||
[kops](https://kops.sigs.k8s.io/) 或
|
||||
[Kubespray](https://kubespray.io/) 作为部署方法。
|
||||
<!--
|
||||
- Configure user management by determining your
|
||||
[Authentication](/docs/reference/access-authn-authz/authentication/) and
|
||||
|
|
|
@ -1,4 +1,44 @@
|
|||
---
|
||||
title: 使用部署工具安装 Kubernetes
|
||||
weight: 30
|
||||
no_list: true
|
||||
---
|
||||
<!--
|
||||
title: Installing Kubernetes with deployment tools
|
||||
weight: 30
|
||||
no_list: true
|
||||
-->
|
||||
|
||||
<!--
|
||||
There are many methods and tools for setting up your own production Kubernetes cluster.
|
||||
For example:
|
||||
|
||||
- [kubeadm](/docs/setup/production-environment/tools/kubeadm/)
|
||||
-->
|
||||
搭建你自己的 Kubernetes 生产集群有许多方法和工具。例如:
|
||||
|
||||
- [kubeadm](/zh-cn/docs/setup/production-environment/tools/kubeadm/)
|
||||
|
||||
<!--
|
||||
- [kops](https://kops.sigs.k8s.io/): An automated cluster provisioning tool.
|
||||
For tutorials, best practices, configuration options and information on
|
||||
reaching out to the community, please check the
|
||||
[`kOps` website](https://kops.sigs.k8s.io/) for details.
|
||||
-->
|
||||
- [kops](https://kops.sigs.k8s.io/):自动化集群制备工具。
|
||||
有关教程、最佳实践、配置选项和社区联系信息,请查阅
|
||||
[`kOps` 网站](https://kops.sigs.k8s.io/)。
|
||||
|
||||
<!--
|
||||
- [kubespray](https://kubespray.io/):
|
||||
A composition of [Ansible](https://docs.ansible.com/) playbooks,
|
||||
[inventory](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/ansible.md#inventory),
|
||||
provisioning tools, and domain knowledge for generic OS/Kubernetes clusters configuration
|
||||
management tasks. You can reach out to the community on Slack channel
|
||||
[#kubespray](https://kubernetes.slack.com/messages/kubespray/).
|
||||
-->
|
||||
- [kubespray](https://kubespray.io/):
|
||||
提供了 [Ansible](https://docs.ansible.com/) Playbook、
|
||||
[清单(inventory)](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/ansible.md#inventory)、
|
||||
制备工具和通用 OS/Kubernetes 集群配置管理任务领域的知识。
|
||||
你可以通过 Slack 频道 [#kubespray](https://kubernetes.slack.com/messages/kubespray/) 联系此社区。
|
||||
|
|
|
@ -1,438 +0,0 @@
|
|||
---
|
||||
title: 使用 kOps 安装 Kubernetes
|
||||
content_type: task
|
||||
weight: 20
|
||||
---
|
||||
<!--
|
||||
title: Installing Kubernetes with kOps
|
||||
content_type: task
|
||||
weight: 20
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
|
||||
<!--
|
||||
This quickstart shows you how to easily install a Kubernetes cluster on AWS.
|
||||
It uses a tool called [`kOps`](https://github.com/kubernetes/kops).
|
||||
-->
|
||||
本篇快速入门介绍了如何在 AWS 上轻松安装 Kubernetes 集群。
|
||||
本篇使用了一个名为 [`kOps`](https://github.com/kubernetes/kops) 的工具。
|
||||
|
||||
<!--
|
||||
`kOps` is an automated provisioning system:
|
||||
-->
|
||||
`kOps` 是一个自动化的制备系统:
|
||||
|
||||
<!--
|
||||
* Fully automated installation
|
||||
* Uses DNS to identify clusters
|
||||
* Self-healing: everything runs in Auto-Scaling Groups
|
||||
* Multiple OS support (Amazon Linux, Debian, Flatcar, RHEL, Rocky and Ubuntu) - see the
|
||||
[images.md](https://github.com/kubernetes/kops/blob/master/docs/operations/images.md)
|
||||
* High-Availability support - see the
|
||||
[high_availability.md](https://github.com/kubernetes/kops/blob/master/docs/operations/high_availability.md)
|
||||
* Can directly provision, or generate terraform manifests - see the
|
||||
[terraform.md](https://github.com/kubernetes/kops/blob/master/docs/terraform.md)
|
||||
-->
|
||||
* 全自动安装流程
|
||||
* 使用 DNS 识别集群
|
||||
* 自我修复:一切都在自动扩缩组中运行
|
||||
* 支持多种操作系统(Amazon Linux、Debian、Flatcar、RHEL、Rocky 和 Ubuntu),
|
||||
参考 [images.md](https://github.com/kubernetes/kops/blob/master/docs/operations/images.md)。
|
||||
* 支持高可用,参考
|
||||
[high_availability.md](https://github.com/kubernetes/kops/blob/master/docs/operations/high_availability.md)。
|
||||
* 可以直接提供或者生成 terraform 清单,参考
|
||||
[terraform.md](https://github.com/kubernetes/kops/blob/master/docs/terraform.md)。
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
<!--
|
||||
* You must have [kubectl](/docs/tasks/tools/) installed.
|
||||
|
||||
* You must [install](https://github.com/kubernetes/kops#installing) `kops` on a 64-bit (AMD64 and Intel 64) device architecture.
|
||||
|
||||
* You must have an [AWS account](https://docs.aws.amazon.com/polly/latest/dg/setting-up.html),
|
||||
generate [IAM keys](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
|
||||
and [configure](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration) them.
|
||||
The IAM user will need [adequate permissions](https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md#setup-iam-user).
|
||||
-->
|
||||
* 你必须安装 [kubectl](/zh-cn/docs/tasks/tools/)。
|
||||
* 你必须安装[安装](https://github.com/kubernetes/kops#installing) `kops`
|
||||
到 64 位的(AMD64 和 Intel 64)设备架构上。
|
||||
* 你必须拥有一个 [AWS 账户](https://docs.aws.amazon.com/zh_cn/polly/latest/dg/setting-up.html),
|
||||
生成 [IAM 秘钥](https://docs.aws.amazon.com/zh_cn/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
|
||||
并[配置](https://docs.aws.amazon.com/zh_cn/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration)
|
||||
该秘钥。IAM 用户需要[足够的权限许可](https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md#setup-iam-user)。
|
||||
|
||||
<!-- steps -->
|
||||
|
||||
<!--
|
||||
## Creating a cluster
|
||||
|
||||
### (1/5) Install kops
|
||||
|
||||
#### Installation
|
||||
|
||||
Download kops from the [releases page](https://github.com/kubernetes/kops/releases)
|
||||
(it is also convenient to build from source):
|
||||
-->
|
||||
## 创建集群 {#creating-a-cluster}
|
||||
|
||||
### (1/5) 安装 kops
|
||||
|
||||
#### 安装
|
||||
|
||||
从[下载页面](https://github.com/kubernetes/kops/releases)下载 kops
|
||||
(从源代码构建也很方便):
|
||||
|
||||
{{< tabs name="kops_installation" >}}
|
||||
{{% tab name="macOS" %}}
|
||||
|
||||
<!--
|
||||
Download the latest release with the command:
|
||||
-->
|
||||
使用下面的命令下载最新发布版本:
|
||||
|
||||
```shell
|
||||
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
To download a specific version, replace the following portion of the command with the specific kops version.
|
||||
-->
|
||||
要下载特定版本,使用特定的 kops 版本替换下面命令中的部分:
|
||||
|
||||
```shell
|
||||
$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)
|
||||
```
|
||||
|
||||
<!--
|
||||
For example, to download kops version v1.20.0 type:
|
||||
-->
|
||||
例如,要下载 kops v1.20.0,输入:
|
||||
|
||||
```shell
|
||||
curl -LO https://github.com/kubernetes/kops/releases/download/v1.20.0/kops-darwin-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
Make the kops binary executable.
|
||||
-->
|
||||
令 kops 二进制文件可执行:
|
||||
|
||||
```shell
|
||||
chmod +x kops-darwin-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
Move the kops binary in to your PATH.
|
||||
-->
|
||||
将 kops 二进制文件移到你的 PATH 下:
|
||||
|
||||
```shell
|
||||
sudo mv kops-darwin-amd64 /usr/local/bin/kops
|
||||
```
|
||||
|
||||
<!--
|
||||
You can also install kops using [Homebrew](https://brew.sh/).
|
||||
-->
|
||||
你也可以使用 [Homebrew](https://brew.sh/) 安装 kops:
|
||||
|
||||
```shell
|
||||
brew update && brew install kops
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="Linux" %}}
|
||||
|
||||
<!--
|
||||
Download the latest release with the command:
|
||||
-->
|
||||
使用命令下载最新发布版本:
|
||||
|
||||
```shell
|
||||
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
To download a specific version of kops, replace the following portion of the command with the specific kops version.
|
||||
-->
|
||||
要下载 kops 的特定版本,用特定的 kops 版本替换下面命令中的部分:
|
||||
|
||||
```shell
|
||||
$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)
|
||||
```
|
||||
|
||||
<!--
|
||||
For example, to download kops version v1.20.0 type:
|
||||
-->
|
||||
例如,要下载 kops v1.20 版本,输入:
|
||||
|
||||
```shell
|
||||
curl -LO https://github.com/kubernetes/kops/releases/download/v1.20.0/kops-linux-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
Make the kops binary executable
|
||||
-->
|
||||
令 kops 二进制文件可执行:
|
||||
|
||||
```shell
|
||||
chmod +x kops-linux-amd64
|
||||
```
|
||||
|
||||
<!--
|
||||
Move the kops binary in to your PATH.
|
||||
-->
|
||||
将 kops 二进制文件移到 PATH 下:
|
||||
|
||||
```shell
|
||||
sudo mv kops-linux-amd64 /usr/local/bin/kops
|
||||
```
|
||||
|
||||
<!--
|
||||
You can also install kops using [Homebrew](https://docs.brew.sh/Homebrew-on-Linux).
|
||||
-->
|
||||
你也可以使用 [Homebrew](https://docs.brew.sh/Homebrew-on-Linux) 来安装 kops。
|
||||
|
||||
```shell
|
||||
brew update && brew install kops
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
<!--
|
||||
### (2/5) Create a route53 domain for your cluster
|
||||
|
||||
kops uses DNS for discovery, both inside the cluster and outside, so that you can reach the kubernetes API server
|
||||
from clients.
|
||||
-->
|
||||
### (2/5) 为你的集群创建一个 route53 域名
|
||||
|
||||
kops 在集群内部和外部都使用 DNS 进行发现操作,这样你可以从客户端访问
|
||||
Kubernetes API 服务器。
|
||||
|
||||
<!--
|
||||
kops has a strong opinion on the cluster name: it should be a valid DNS name. By doing so you will
|
||||
no longer get your clusters confused, you can share clusters with your colleagues unambiguously,
|
||||
and you can reach them without relying on remembering an IP address.
|
||||
-->
|
||||
kops 对集群名称有明显的要求:它应该是有效的 DNS 名称。这样一来,你就不会再使集群混乱,
|
||||
可以与同事明确共享集群,并且无需依赖记住 IP 地址即可访问集群。
|
||||
|
||||
<!--
|
||||
You can, and probably should, use subdomains to divide your clusters. As our example we will use
|
||||
`useast1.dev.example.com`. The API server endpoint will then be `api.useast1.dev.example.com`.
|
||||
-->
|
||||
你可以,或许应该使用子域名来划分集群。作为示例,我们将使用域名 `useast1.dev.example.com`。
|
||||
这样,API 服务器端点域名将为 `api.useast1.dev.example.com`。
|
||||
|
||||
<!--
|
||||
A Route53 hosted zone can serve subdomains. Your hosted zone could be `useast1.dev.example.com`,
|
||||
but also `dev.example.com` or even `example.com`. kops works with any of these, so typically
|
||||
you choose for organization reasons (e.g. you are allowed to create records under `dev.example.com`,
|
||||
but not under `example.com`).
|
||||
-->
|
||||
Route53 托管区域可以服务子域名。你的托管区域可能是 `useast1.dev.example.com`,
|
||||
还有 `dev.example.com` 甚至 `example.com`。
|
||||
kops 可以与以上任何一种配合使用,因此通常你出于组织原因选择不同的托管区域。
|
||||
例如,允许你在 `dev.example.com` 下创建记录,但不能在 `example.com` 下创建记录。
|
||||
|
||||
<!--
|
||||
Let's assume you're using `dev.example.com` as your hosted zone. You create that hosted zone using
|
||||
the [normal process](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html), or
|
||||
with a command such as `aws route53 create-hosted-zone --name dev.example.com --caller-reference 1`.
|
||||
-->
|
||||
假设你使用 `dev.example.com` 作为托管区域。你可以使用
|
||||
[正常流程](https://docs.aws.amazon.com/zh_cn/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html)
|
||||
或者使用诸如 `aws route53 create-hosted-zone --name dev.example.com --caller-reference 1`
|
||||
之类的命令来创建该托管区域。
|
||||
|
||||
<!--
|
||||
You must then set up your NS records in the parent domain, so that records in the domain will resolve. Here,
|
||||
you would create NS records in `example.com` for `dev`. If it is a root domain name you would configure the NS
|
||||
records at your domain registrar (e.g. `example.com` would need to be configured where you bought `example.com`).
|
||||
-->
|
||||
然后,你必须在父域名中设置你的 DNS 记录,以便该域名中的记录可以被解析。
|
||||
在这里,你将在 `example.com` 中为 `dev` 创建 DNS 记录。
|
||||
如果它是根域名,则可以在域名注册机构配置 DNS 记录。
|
||||
例如,你需要在购买 `example.com` 的地方配置 `example.com`。
|
||||
|
||||
<!--
|
||||
Verify your route53 domain setup (it is the #1 cause of problems!). You can double-check that
|
||||
your cluster is configured correctly if you have the dig tool by running:
|
||||
-->
|
||||
检查你的 route53 域已经被正确设置(这是导致问题的最常见原因!)。
|
||||
如果你安装了 dig 工具,则可以通过运行以下步骤再次检查集群是否配置正确:
|
||||
|
||||
`dig NS dev.example.com`
|
||||
|
||||
<!--
|
||||
You should see the 4 NS records that Route53 assigned your hosted zone.
|
||||
-->
|
||||
你应该看到 Route53 分配了你的托管区域的 4 条 DNS 记录。
|
||||
|
||||
<!--
|
||||
### (3/5) Create an S3 bucket to store your clusters state
|
||||
|
||||
kops lets you manage your clusters even after installation. To do this, it must keep track of the clusters
|
||||
that you have created, along with their configuration, the keys they are using etc. This information is stored
|
||||
in an S3 bucket. S3 permissions are used to control access to the bucket.
|
||||
-->
|
||||
### (3/5) 创建一个 S3 存储桶来存储集群状态
|
||||
|
||||
kops 使你即使在安装后也可以管理集群。为此,它必须跟踪已创建的集群及其配置、所使用的密钥等。
|
||||
此信息存储在 S3 存储桶中。S3 权限用于控制对存储桶的访问。
|
||||
|
||||
<!--
|
||||
Multiple clusters can use the same S3 bucket, and you can share an S3 bucket between your colleagues that
|
||||
administer the same clusters - this is much easier than passing around kubecfg files. But anyone with access
|
||||
to the S3 bucket will have administrative access to all your clusters, so you don't want to share it beyond
|
||||
the operations team.
|
||||
-->
|
||||
多个集群可以使用同一 S3 存储桶,并且你可以在管理同一集群的同事之间共享一个
|
||||
S3 存储桶 - 这比传递 kubecfg 文件容易得多。
|
||||
但是有权访问 S3 存储桶的任何人都将拥有对所有集群的管理访问权限,
|
||||
因此你不想在运营团队之外共享它。
|
||||
|
||||
<!--
|
||||
So typically you have one S3 bucket for each ops team (and often the name will correspond
|
||||
to the name of the hosted zone above!)
|
||||
-->
|
||||
因此,通常每个运维团队都有一个 S3 存储桶(而且名称通常对应于上面托管区域的名称!)
|
||||
|
||||
<!--
|
||||
In our example, we chose `dev.example.com` as our hosted zone, so let's pick `clusters.dev.example.com` as
|
||||
the S3 bucket name.
|
||||
-->
|
||||
在我们的示例中,我们选择 `dev.example.com` 作为托管区域,因此我们选择
|
||||
`clusters.dev.example.com` 作为 S3 存储桶名称。
|
||||
|
||||
<!--
|
||||
* Export `AWS_PROFILE` (if you need to select a profile for the AWS CLI to work)
|
||||
* Create the S3 bucket using `aws s3 mb s3://clusters.dev.example.com`
|
||||
* You can `export KOPS_STATE_STORE=s3://clusters.dev.example.com` and then kops will use this location by default.
|
||||
We suggest putting this in your bash profile or similar.
|
||||
-->
|
||||
* 导出 `AWS_PROFILE` 文件(如果你需要选择一个配置文件用来使 AWS CLI 正常工作)
|
||||
* 使用 `aws s3 mb s3://clusters.dev.example.com` 创建 S3 存储桶
|
||||
* 你可以进行 `export KOPS_STATE_STORE=s3://clusters.dev.example.com` 操作,
|
||||
然后 kops 将默认使用此位置。
|
||||
我们建议将其放入你的 bash profile 文件或类似文件中。
|
||||
|
||||
<!--
|
||||
### (4/5) Build your cluster configuration
|
||||
|
||||
Run `kops create cluster` to create your cluster configuration:
|
||||
-->
|
||||
### (4/5) 建立你的集群配置
|
||||
|
||||
运行 `kops create cluster` 以创建你的集群配置:
|
||||
|
||||
`kops create cluster --zones=us-east-1c useast1.dev.example.com`
|
||||
|
||||
<!--
|
||||
kops will create the configuration for your cluster. Note that it _only_ creates the configuration, it does
|
||||
not actually create the cloud resources - you'll do that in the next step with a `kops update cluster`. This
|
||||
give you an opportunity to review the configuration or change it.
|
||||
-->
|
||||
kops 将为你的集群创建配置。请注意,它**仅**创建配置,实际上并没有创建云资源。
|
||||
你将在下一步中使用 `kops update cluster` 进行创建。
|
||||
这使你有机会查看配置或进行更改。
|
||||
|
||||
<!--
|
||||
It prints commands you can use to explore further:
|
||||
-->
|
||||
它打印出可用于进一步探索的命令:
|
||||
|
||||
<!--
|
||||
* List your clusters with: `kops get cluster`
|
||||
* Edit this cluster with: `kops edit cluster useast1.dev.example.com`
|
||||
* Edit your node instance group: `kops edit ig --name=useast1.dev.example.com nodes`
|
||||
* Edit your master instance group: `kops edit ig --name=useast1.dev.example.com master-us-east-1c`
|
||||
-->
|
||||
* 使用以下命令列出集群:`kops get cluster`
|
||||
* 使用以下命令编辑该集群:`kops edit cluster useast1.dev.example.com`
|
||||
* 使用以下命令编辑你的节点实例组:`kops edit ig --name = useast1.dev.example.com nodes`
|
||||
* 使用以下命令编辑你的主实例组:`kops edit ig --name = useast1.dev.example.com master-us-east-1c`
|
||||
|
||||
<!--
|
||||
If this is your first time using kops, do spend a few minutes to try those out! An instance group is a
|
||||
set of instances, which will be registered as kubernetes nodes. On AWS this is implemented via auto-scaling-groups.
|
||||
You can have several instance groups, for example if you wanted nodes that are a mix of spot and on-demand instances, or
|
||||
GPU and non-GPU instances.
|
||||
-->
|
||||
如果这是你第一次使用 kops,请花几分钟尝试一下!实例组是一组实例,将被注册为 Kubernetes 节点。
|
||||
在 AWS 上,这是通过 auto-scaling-groups 实现的。你可以有多个实例组。
|
||||
例如,你可能想要混合了 Spot 实例和按需实例的节点,或者混合了 GPU 实例和非 GPU 实例的节点。
|
||||
|
||||
<!--
|
||||
### (5/5) Create the cluster in AWS
|
||||
|
||||
Run `kops update cluster` to create your cluster in AWS:
|
||||
-->
|
||||
### (5/5) 在 AWS 中创建集群
|
||||
|
||||
运行 `kops update cluster` 以在 AWS 中创建集群:
|
||||
|
||||
`kops update cluster useast1.dev.example.com --yes`
|
||||
|
||||
<!--
|
||||
That takes a few seconds to run, but then your cluster will likely take a few minutes to actually be ready.
|
||||
`kops update cluster` will be the tool you'll use whenever you change the configuration of your cluster; it
|
||||
applies the changes you have made to the configuration to your cluster - reconfiguring AWS or kubernetes as needed.
|
||||
-->
|
||||
这需要几秒钟的时间才能运行,但实际上集群可能需要几分钟才能准备就绪。
|
||||
每当更改集群配置时,都会使用 `kops update cluster` 工具。
|
||||
它将在集群中应用你对配置进行的更改,根据需要重新配置 AWS 或者 Kubernetes。
|
||||
|
||||
<!--
|
||||
For example, after you `kops edit ig nodes`, then `kops update cluster --yes` to apply your configuration, and
|
||||
sometimes you will also have to `kops rolling-update cluster` to roll out the configuration immediately.
|
||||
-->
|
||||
例如,在你运行 `kops edit ig nodes` 之后,然后运行 `kops update cluster --yes`
|
||||
应用你的配置,有时你还必须运行 `kops rolling-update cluster` 立即回滚更新配置。
|
||||
|
||||
<!--
|
||||
Without `--yes`, `kops update cluster` will show you a preview of what it is going to do. This is handy
|
||||
for production clusters!
|
||||
-->
|
||||
如果没有 `--yes` 参数,`kops update cluster` 操作将向你显示其操作的预览效果。这对于生产集群很方便!
|
||||
|
||||
<!--
|
||||
### Explore other add-ons
|
||||
|
||||
See the [list of add-ons](/docs/concepts/cluster-administration/addons/) to explore other add-ons,
|
||||
including tools for logging, monitoring, network policy, visualization, and control of your Kubernetes cluster.
|
||||
-->
|
||||
### 探索其他附加组件
|
||||
|
||||
请参阅[附加组件列表](/zh-cn/docs/concepts/cluster-administration/addons/)探索其他附加组件,
|
||||
包括用于 Kubernetes 集群的日志记录、监视、网络策略、可视化和控制的工具。
|
||||
|
||||
<!--
|
||||
## Cleanup
|
||||
|
||||
* To delete your cluster: `kops delete cluster useast1.dev.example.com --yes`
|
||||
-->
|
||||
## 清理 {#cleanup}
|
||||
|
||||
* 删除集群:`kops delete cluster useast1.dev.example.com --yes`
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
<!--
|
||||
* Learn more about Kubernetes [concepts](/docs/concepts/) and [`kubectl`](/docs/reference/kubectl/).
|
||||
* Learn more about `kOps` [advanced usage](https://kops.sigs.k8s.io/) for tutorials,
|
||||
best practices and advanced configuration options.
|
||||
* Follow `kOps` community discussions on Slack:
|
||||
[community discussions](https://kops.sigs.k8s.io/contributing/#other-ways-to-communicate-with-the-contributors).
|
||||
(visit https://slack.k8s.io/ for an invitation to this Slack workspace).
|
||||
* Contribute to `kOps` by addressing or raising an issue [GitHub Issues](https://github.com/kubernetes/kops/issues).
|
||||
-->
|
||||
* 了解有关 Kubernetes 的[概念](/zh-cn/docs/concepts/)和
|
||||
[`kubectl`](/zh-cn/docs/reference/kubectl/) 的更多信息。
|
||||
* 参阅 `kOps` [进阶用法](https://kops.sigs.k8s.io/) 获取教程、最佳实践和进阶配置选项。
|
||||
* 通过 Slack:[社区讨论](https://kops.sigs.k8s.io/contributing/#other-ways-to-communicate-with-the-contributors)
|
||||
参与 `kOps` 社区讨论。(访问 https://slack.k8s.io/ 获取此 Slack 工作空间的邀请)
|
||||
* 通过解决或提出一个 [GitHub Issue](https://github.com/kubernetes/kops/issues) 来为 `kOps` 做贡献。
|
|
@ -1,313 +0,0 @@
|
|||
---
|
||||
title: 使用 Kubespray 安装 Kubernetes
|
||||
content_type: concept
|
||||
weight: 30
|
||||
---
|
||||
<!--
|
||||
title: Installing Kubernetes with Kubespray
|
||||
content_type: concept
|
||||
weight: 30
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
|
||||
<!--
|
||||
This quickstart helps to install a Kubernetes cluster hosted on GCE, Azure, OpenStack,
|
||||
AWS, vSphere, Equinix Metal (formerly Packet), Oracle Cloud Infrastructure (Experimental)
|
||||
or Baremetal with [Kubespray](https://github.com/kubernetes-sigs/kubespray).
|
||||
-->
|
||||
此快速入门有助于使用 [Kubespray](https://github.com/kubernetes-sigs/kubespray)
|
||||
安装在 GCE、Azure、OpenStack、AWS、vSphere、Equinix Metal(曾用名 Packet)、Oracle Cloud
|
||||
Infrastructure(实验性)或 Baremetal 上托管的 Kubernetes 集群。
|
||||
|
||||
<!--
|
||||
Kubespray is a composition of [Ansible](https://docs.ansible.com/) playbooks,
|
||||
[inventory](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/ansible.md#inventory),
|
||||
provisioning tools, and domain knowledge for generic OS/Kubernetes clusters configuration management tasks.
|
||||
|
||||
Kubespray provides:
|
||||
-->
|
||||
Kubespray 是由若干 [Ansible](https://docs.ansible.com/) Playbook、
|
||||
[清单(inventory)](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/ansible.md#inventory)、
|
||||
制备工具和通用 OS/Kubernetes 集群配置管理任务的领域知识组成的。
|
||||
|
||||
Kubespray 提供:
|
||||
|
||||
<!--
|
||||
* Highly available cluster.
|
||||
* Composable (Choice of the network plugin for instance).
|
||||
* Supports most popular Linux distributions:
|
||||
- Flatcar Container Linux by Kinvolk
|
||||
- Debian Bullseye, Buster, Jessie, Stretch
|
||||
- Ubuntu 16.04, 18.04, 20.04, 22.04
|
||||
- CentOS/RHEL 7, 8, 9
|
||||
- Fedora 35, 36
|
||||
- Fedora CoreOS
|
||||
- openSUSE Leap 15.x/Tumbleweed
|
||||
- Oracle Linux 7, 8, 9
|
||||
- Alma Linux 8, 9
|
||||
- Rocky Linux 8, 9
|
||||
- Kylin Linux Advanced Server V10
|
||||
- Amazon Linux 2
|
||||
* Continuous integration tests.
|
||||
-->
|
||||
- 高可用性集群
|
||||
- 可组合属性(例如可选择网络插件)
|
||||
- 支持大多数流行的 Linux 发行版
|
||||
- Flatcar Container Linux
|
||||
- Debian Bullseye、Buster、Jessie、Stretch
|
||||
- Ubuntu 16.04、18.04、20.04、22.04
|
||||
- CentOS/RHEL 7、8、9
|
||||
- Fedora 35、36
|
||||
- Fedora CoreOS
|
||||
- openSUSE Leap 15.x/Tumbleweed
|
||||
- Oracle Linux 7、8、9
|
||||
- Alma Linux 8、9
|
||||
- Rocky Linux 8、9
|
||||
- Kylin Linux Advanced Server V10
|
||||
- Amazon Linux 2
|
||||
- 持续集成测试
|
||||
|
||||
<!--
|
||||
To choose a tool which best fits your use case, read
|
||||
[this comparison](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/comparisons.md) to
|
||||
[kubeadm](/docs/reference/setup-tools/kubeadm/) and [kops](/docs/setup/production-environment/tools/kops/).
|
||||
-->
|
||||
要选择最适合你的用例的工具,请阅读
|
||||
[kubeadm](/zh-cn/docs/reference/setup-tools/kubeadm/) 和
|
||||
[kops](/zh-cn/docs/setup/production-environment/tools/kops/)
|
||||
之间的[这份比较](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/comparisons.md)。
|
||||
|
||||
<!-- body -->
|
||||
|
||||
<!--
|
||||
## Creating a cluster
|
||||
|
||||
### (1/5) Meet the underlay requirements
|
||||
-->
|
||||
## 创建集群 {#creating-a-cluster}
|
||||
|
||||
### (1/5)满足下层设施要求
|
||||
|
||||
<!--
|
||||
Provision servers with the following [requirements](https://github.com/kubernetes-sigs/kubespray#requirements):
|
||||
-->
|
||||
按以下[要求](https://github.com/kubernetes-sigs/kubespray#requirements)来配置服务器:
|
||||
|
||||
<!--
|
||||
* **Minimum required version of Kubernetes is v1.22**
|
||||
* **Ansible v2.11+, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands**
|
||||
* The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required See ([Offline Environment](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/offline-environment.md))
|
||||
* The target servers are configured to allow **IPv4 forwarding**.
|
||||
* If using IPv6 for pods and services, the target servers are configured to allow **IPv6 forwarding**.
|
||||
* The **firewalls are not managed**, you'll need to implement your own rules the way you used to.
|
||||
in order to avoid any issue during deployment you should disable your firewall.
|
||||
* If kubespray is run from non-root user account, correct privilege escalation method
|
||||
should be configured in the target servers. Then the `ansible_become` flag or command
|
||||
parameters `--become` or `-b` should be specified.
|
||||
-->
|
||||
* **Kubernetes** 的最低版本要求为 V1.22
|
||||
* **在将运行 Ansible 命令的计算机上安装 Ansible v2.11(或更高版本)、Jinja 2.11(或更高版本)和 python-netaddr**
|
||||
* 目标服务器必须**能够访问 Internet** 才能拉取 Docker 镜像。否则,
|
||||
需要其他配置([请参见离线环境](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/offline-environment.md))
|
||||
* 目标服务器配置为允许 **IPv4 转发**
|
||||
* 如果针对 Pod 和 Service 使用 IPv6,则目标服务器配置为允许 **IPv6 转发**
|
||||
* **防火墙不是由 kubespray 管理的**。你需要根据需求设置适当的规则策略。为了避免部署过程中出现问题,可以禁用防火墙。
|
||||
* 如果从非 root 用户帐户运行 kubespray,则应在目标服务器中配置正确的特权升级方法并指定
|
||||
`ansible_become` 标志或命令参数 `--become` 或 `-b`
|
||||
|
||||
<!--
|
||||
Kubespray provides the following utilities to help provision your environment:
|
||||
|
||||
* [Terraform](https://www.terraform.io/) scripts for the following cloud providers:
|
||||
* [AWS](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/aws)
|
||||
* [OpenStack](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/openstack)
|
||||
* [Equinix Metal](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/equinix)
|
||||
-->
|
||||
Kubespray 提供以下实用程序来帮助你设置环境:
|
||||
|
||||
* 为以下云驱动提供的 [Terraform](https://www.terraform.io/) 脚本:
|
||||
* [AWS](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/aws)
|
||||
* [OpenStack](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/openstack)
|
||||
* [Equinix Metal](https://github.com/kubernetes-sigs/kubespray/tree/master/contrib/terraform/equinix)
|
||||
|
||||
<!--
|
||||
### (2/5) Compose an inventory file
|
||||
|
||||
After you provision your servers, create an
|
||||
[inventory file for Ansible](https://docs.ansible.com/ansible/latest/network/getting_started/first_inventory.html).
|
||||
You can do this manually or via a dynamic inventory script. For more information,
|
||||
see "[Building your own inventory](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#building-your-own-inventory)".
|
||||
|
||||
### (3/5) Plan your cluster deployment
|
||||
|
||||
Kubespray provides the ability to customize many aspects of the deployment:
|
||||
-->
|
||||
### (2/5)编写清单文件
|
||||
|
||||
设置服务器后,请创建一个
|
||||
[Ansible 的清单文件](https://docs.ansible.com/ansible/latest/network/getting_started/first_inventory.html)。
|
||||
你可以手动执行此操作,也可以通过动态清单脚本执行此操作。有关更多信息,请参阅
|
||||
“[建立你自己的清单](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#building-your-own-inventory)”。
|
||||
|
||||
### (3/5)规划集群部署
|
||||
|
||||
Kubespray 能够自定义部署的许多方面:
|
||||
|
||||
<!--
|
||||
* Choice deployment mode: kubeadm or non-kubeadm
|
||||
* CNI (networking) plugins
|
||||
* DNS configuration
|
||||
* Choice of control plane: native/binary or containerized
|
||||
* Component versions
|
||||
* Calico route reflectors
|
||||
* Component runtime options
|
||||
* {{< glossary_tooltip term_id="docker" >}}
|
||||
* {{< glossary_tooltip term_id="containerd" >}}
|
||||
* {{< glossary_tooltip term_id="cri-o" >}}
|
||||
* Certificate generation methods
|
||||
-->
|
||||
* 选择部署模式:kubeadm 或非 kubeadm
|
||||
* CNI(网络)插件
|
||||
* DNS 配置
|
||||
* 控制平面的选择:本机/可执行文件或容器化
|
||||
* 组件版本
|
||||
* Calico 路由反射器
|
||||
* 组件运行时选项
|
||||
* {{< glossary_tooltip term_id="docker" >}}
|
||||
* {{< glossary_tooltip term_id="containerd" >}}
|
||||
* {{< glossary_tooltip term_id="cri-o" >}}
|
||||
* 证书生成方式
|
||||
|
||||
<!--
|
||||
Kubespray customizations can be made to a
|
||||
[variable file](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html).
|
||||
If you are getting started with Kubespray, consider using the Kubespray
|
||||
defaults to deploy your cluster and explore Kubernetes.
|
||||
-->
|
||||
可以修改[变量文件](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html)以进行
|
||||
Kubespray 定制。
|
||||
如果你刚刚开始使用 Kubespray,请考虑使用 Kubespray 默认设置来部署你的集群并探索 Kubernetes。
|
||||
|
||||
<!--
|
||||
### (4/5) Deploy a Cluster
|
||||
|
||||
Next, deploy your cluster:
|
||||
|
||||
Cluster deployment using
|
||||
[ansible-playbook](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#starting-custom-deployment).
|
||||
-->
|
||||
### (4/5)部署集群
|
||||
|
||||
接下来,部署你的集群:
|
||||
|
||||
使用 [ansible-playbook](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#starting-custom-deployment)
|
||||
进行集群部署。
|
||||
|
||||
```shell
|
||||
ansible-playbook -i your/inventory/inventory.ini cluster.yml -b -v \
|
||||
--private-key=~/.ssh/private_key
|
||||
```
|
||||
|
||||
<!--
|
||||
Large deployments (100+ nodes) may require
|
||||
[specific adjustments](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/large-deployments.md)
|
||||
for best results.
|
||||
-->
|
||||
大型部署(超过 100 个节点)
|
||||
可能需要[特定的调整](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/large-deployments.md),
|
||||
以获得最佳效果。
|
||||
|
||||
<!--
|
||||
### (5/5) Verify the deployment
|
||||
|
||||
Kubespray provides a way to verify inter-pod connectivity and DNS resolve with
|
||||
[Netchecker](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/netcheck.md).
|
||||
Netchecker ensures the netchecker-agents pods can resolve DNS requests and ping each
|
||||
over within the default namespace. Those pods mimic similar behavior as the rest
|
||||
of the workloads and serve as cluster health indicators.
|
||||
-->
|
||||
### (5/5)验证部署
|
||||
|
||||
Kubespray 提供了一种使用
|
||||
[Netchecker](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/netcheck.md)
|
||||
验证 Pod 间连接和 DNS 解析的方法。
|
||||
Netchecker 确保 netchecker-agents Pod 可以解析 DNS 请求,
|
||||
并在默认命名空间内对每个请求执行 ping 操作。
|
||||
这些 Pod 模仿其他工作负载类似的行为,并用作集群运行状况指示器。
|
||||
|
||||
<!--
|
||||
## Cluster operations
|
||||
|
||||
Kubespray provides additional playbooks to manage your cluster: _scale_ and _upgrade_.
|
||||
-->
|
||||
## 集群操作 {#cluster-operations}
|
||||
|
||||
Kubespray 提供了其他 Playbook 来管理集群: **scale** 和 **upgrade**。
|
||||
|
||||
<!--
|
||||
### Scale your cluster
|
||||
|
||||
You can add worker nodes from your cluster by running the scale playbook. For more information,
|
||||
see "[Adding nodes](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#adding-nodes)".
|
||||
You can remove worker nodes from your cluster by running the remove-node playbook. For more information,
|
||||
see "[Remove nodes](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#remove-nodes)".
|
||||
-->
|
||||
### 扩展集群 {#scale-your-cluster}
|
||||
|
||||
你可以通过运行 scale playbook 向集群中添加工作节点。有关更多信息,
|
||||
请参见 “[添加节点](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#adding-nodes)”。
|
||||
你可以通过运行 remove-node playbook 来从集群中删除工作节点。有关更多信息,
|
||||
请参见 “[删除节点](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#remove-nodes)”。
|
||||
|
||||
<!--
|
||||
### Upgrade your cluster
|
||||
|
||||
You can upgrade your cluster by running the upgrade-cluster playbook. For more information,
|
||||
see "[Upgrades](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/upgrades.md)".
|
||||
-->
|
||||
### 升级集群 {#upgrade-your-cluster}
|
||||
|
||||
你可以通过运行 upgrade-cluster Playbook 来升级集群。有关更多信息,请参见
|
||||
“[升级](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/upgrades.md)”。
|
||||
|
||||
<!--
|
||||
## Cleanup
|
||||
|
||||
You can reset your nodes and wipe out all components installed with Kubespray
|
||||
via the [reset playbook](https://github.com/kubernetes-sigs/kubespray/blob/master/reset.yml).
|
||||
-->
|
||||
## 清理 {#cleanup}
|
||||
|
||||
你可以通过 [reset playbook](https://github.com/kubernetes-sigs/kubespray/blob/master/reset.yml)
|
||||
重置节点并清除所有与 Kubespray 一起安装的组件。
|
||||
|
||||
{{< caution >}}
|
||||
<!--
|
||||
When running the reset playbook, be sure not to accidentally target your production cluster!
|
||||
-->
|
||||
运行 reset playbook 时,请确保不要意外地将生产集群作为目标!
|
||||
{{< /caution >}}
|
||||
|
||||
<!--
|
||||
## Feedback
|
||||
|
||||
* Slack Channel: [#kubespray](https://kubernetes.slack.com/messages/kubespray/)
|
||||
(You can get your invite [here](https://slack.k8s.io/)).
|
||||
* [GitHub Issues](https://github.com/kubernetes-sigs/kubespray/issues).
|
||||
-->
|
||||
## 反馈 {#feedback}
|
||||
|
||||
* Slack 频道:[#kubespray](https://kubernetes.slack.com/messages/kubespray/)
|
||||
(你可以在[此处](https://slack.k8s.io/)获得邀请)。
|
||||
* [GitHub 问题](https://github.com/kubernetes-sigs/kubespray/issues)。
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
<!--
|
||||
* Check out planned work on Kubespray's [roadmap](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/roadmap.md).
|
||||
* Learn more about [Kubespray](https://github.com/kubernetes-sigs/kubespray).
|
||||
-->
|
||||
* 查看有关 Kubespray
|
||||
[路线图](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/roadmap.md)的计划工作。
|
||||
* 查阅有关 [Kubespray](https://github.com/kubernetes-sigs/kubespray) 的更多信息。
|
Loading…
Reference in New Issue