[zh] Tidy up and fix links in tasks section (8/10)

This commit is contained in:
Qiming Teng
2020-08-16 11:05:13 +08:00
parent fb6364da0a
commit c2aae6890f
10 changed files with 613 additions and 540 deletions
@@ -1,25 +1,26 @@
---
reviewers:
- sig-cluster-lifecycle
title: 升级 kubeadm 集群
content_type: task
weight: 20
min-kubernetes-server-version: 1.18
---
<!--
---
reviewers:
- sig-cluster-lifecycle
title: Upgrading kubeadm clusters
content_type: task
---
weight: 20
min-kubernetes-server-version: 1.18
-->
<!-- overview -->
<!--
This page explains how to upgrade a Kubernetes cluster created with kubeadm from version
1.16.x to version 1.17.x, and from version 1.17.x to 1.17.y (where `y > x`).
1.17.x to version 1.18.x, and from version 1.18.x to 1.18.y (where `y > x`).
-->
本页介绍如何将 `kubeadm` 创建的 Kubernetes 集群从 1.16.x 版本升级到 1.17.x 版本,以及从版本 1.17.x 升级到 1.17.y ,其中 `y > x`
本页介绍如何将 `kubeadm` 创建的 Kubernetes 集群从 1.17.x 版本升级到 1.18.x 版本,
或者从版本 1.18.x 升级到 1.18.y ,其中 `y > x`
<!--
To see information about upgrading clusters created using older versions of kubeadm,
@@ -47,79 +48,68 @@ The upgrade workflow at high level is the following:
-->
升级工作的基本流程如下:
1. 升级主控制平面节点
1. 升级其他控制平面节点
1. 升级工作节点
1. 升级主控制平面节点
1. 升级其他控制平面节点
1. 升级工作节点
## {{% heading "prerequisites" %}}
<!--
- You need to have a kubeadm Kubernetes cluster running version 1.16.0 or later.
- You need to have a kubeadm Kubernetes cluster running version 1.17.0 or later.
- [Swap must be disabled](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux).
- The cluster should use a static control plane and etcd pods or external etcd.
- Make sure you read the [release notes]({{< latest-release-notes >}}) carefully.
- Make sure to back up any important components, such as app-level state stored in a database.
`kubeadm upgrade` does not touch your workloads, only components internal to Kubernetes, but backups are always a best practice.
-->
- 需要有一个由 `kubeadm` 创建并运行着 1.16.0 或更高版本的 Kubernetes 集群。
- [禁用 Swap](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux)。
- 集群应使用静态的控制平面和 etcd pod 或者 外部 etcd。
- 需要有一个由 `kubeadm` 创建并运行着 1.17.0 或更高版本的 Kubernetes 集群。
- [禁用交换分区](https://serverfault.com/questions/684771/best-way-to-disable-swap-in-linux)。
- 集群应使用静态的控制平面和 etcd Pod 或者 外部 etcd。
- 务必仔细认真阅读[发行说明]({{< latest-release-notes >}})。
- 务必备份所有重要组件,例如存储在数据库中应用层面的状态。
`kubeadm upgrade` 不会影响的工作负载,只会涉及 Kubernetes 内部的组件,但备份终究是好的。
`kubeadm upgrade` 不会影响的工作负载,只会涉及 Kubernetes 内部的组件,但备份终究是好的。
<!--
### Additional information
-->
### 附加信息
<!--
- All containers are restarted after upgrade, because the container spec hash value is changed.
- You only can upgrade from one MINOR version to the next MINOR version,
or between PATCH versions of the same MINOR. That is, you cannot skip MINOR versions when you upgrade.
For example, you can upgrade from 1.y to 1.y+1, but not from 1.y to 1.y+2.
-->
- 升级后,因为容器 spec 哈希值已更改,所以所有容器都会重新启动。
- 您只能从一个次版本升级到下一个次版本,或者同样次版本的补丁版。也就是说,升级时无法跳过版本。
例如,您只能从 1.y 升级到 1.y+1,而不能从 from 1.y 升级到 1.y+2
### 附加信息
- 升级后,因为容器规约的哈希值已更改,所有容器都会被重新启动
- 你只能从一个次版本升级到下一个次版本,或者在次版本相同时升级补丁版本。
也就是说,升级时不可以跳过次版本。
例如,你只能从 1.y 升级到 1.y+1,而不能从 from 1.y 升级到 1.y+2。
<!-- steps -->
<!--
## Determine which version to upgrade to
Find the latest stable 1.18 version:
-->
## 确定要升级到哪个版本
<!--
Find the latest stable 1.18 version:
{{< tabs name="k8s_install_versions" >}}
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
apt update
apt-cache policy kubeadm
# find the latest 1.18 version in the list
# it should look like 1.18.x-00, where x is the latest patch
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
yum list --showduplicates kubeadm --disableexcludes=kubernetes
# find the latest 1.18 version in the list
# it should look like 1.18.x-0, where x is the latest patch
{{% /tab %}}
{{< /tabs >}}
-->
找到最新的稳定版 1.18
{{< tabs name="k8s_install_versions" >}}
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
apt update
apt-cache policy kubeadm
# 在列表中查找最新的 1.18 版本
# 它看起来应该是 1.18.x-00 ,其中 x 是最新的补丁
{{% tab name="UbuntuDebian HypriotOS" %}}
```
apt update
apt-cache policy kubeadm
# 在列表中查找最新的 1.18 版本
# 它看起来应该是 1.18.x-00 ,其中 x 是最新的补丁
```
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
yum list --showduplicates kubeadm --disableexcludes=kubernetes
# 在列表中查找最新的 1.18 版本
# 它看起来应该是 1.18.x-0 ,其中 x 是最新的补丁版本
{{% tab name="CentOSRHEL Fedora" %}}
```
yum list --showduplicates kubeadm --disableexcludes=kubernetes
# 在列表中查找最新的 1.18 版本
# 它看起来应该是 1.18.x-0 ,其中 x 是最新的补丁版本
```
{{% /tab %}}
{{< /tabs >}}
@@ -134,32 +124,23 @@ Find the latest stable 1.18 version:
<!--
- On your first control plane node, upgrade kubeadm:
{{< tabs name="k8s_install_kubeadm_first_cp" >}}
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
# replace x in 1.18.x-00 with the latest patch version
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
# replace x in 1.18.x-0 with the latest patch version
yum install -y kubeadm-1.18.x-0 -disableexcludes=kubernetes
{{% /tab %}}
{{< /tabs >}}
-->
- 在第一个控制平面节点上,升级 kubeadm :
{{< tabs name="k8s_install_kubeadm_first_cp" >}}
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
# 用最新的修补程序版本替换 1.18.x-00 中的 x
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
{{% tab name="UbuntuDebian HypriotOS" %}}
```shell
# 用最新的修补程序版本替换 1.18.x-00 中的 x
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
```
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
# 用最新的修补程序版本替换 1.18.x-0 中的 x
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
{{% tab name="CentOSRHEL Fedora" %}}
```shell
# 用最新的修补程序版本替换 1.18.x-0 中的 x
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
```
{{% /tab %}}
{{< /tabs >}}
@@ -202,7 +183,7 @@ Find the latest stable 1.18 version:
<!--
You should see output similar to this:
-->
应该可以看到与下面类似的输出:
应该可以看到与下面类似的输出:
```none
[upgrade/config] Making sure the configuration is correct:
@@ -240,18 +221,17 @@ Find the latest stable 1.18 version:
<!--
This command checks that your cluster can be upgraded, and fetches the versions you can upgrade to.
-->
此命令检查的集群是否可以升级,并可以获取到升级的版本。
此命令检查的集群是否可以升级,并可以获取到升级的版本。
<!--
`kubeadm upgrade` also automatically renews the certificates that it manages on this node.
To opt-out of certificate renewal the flag `-certificate-renewal=false` can be used.
For more information see the [certificate management guide](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs).
-->
{{< note >}}
`kubeadm upgrade` 也会自动对它在此节点上管理的证书进行续约。
如果选择不对证书进行续约,可以使用标志 `--certificate-renewal=false`。
关于更多细节信息,可参见[证书管理指南](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs)。
关于更多细节信息,可参见[证书管理指南](/zh/docs/tasks/administer-cluster/kubeadm/kubeadm-certs)。
{{</ note >}}
<!--
@@ -272,7 +252,7 @@ For more information see the [certificate management guide](/docs/tasks/administ
<!--
You should see output similar to this:
-->
应该可以看见与下面类似的输出:
应该可以看见与下面类似的输出:
```none
[upgrade/config] Making sure the configuration is correct:
@@ -364,8 +344,9 @@ For more information see the [certificate management guide](/docs/tasks/administ
-->
- 手动升级你的 CNI 驱动插件。
的容器网络接口(CNI)驱动应该提供了程序自身的升级说明。
检查[插件](/docs/concepts/cluster-administration/addons/)页面查找 CNI 所提供的程序,并查看是否需要其他升级步骤。
的容器网络接口(CNI)驱动应该提供了程序自身的升级说明。
参阅[插件](/zh/docs/concepts/cluster-administration/addons/)页面查找 CNI 所提供的程序,
并查看是否需要其他升级步骤。
如果 CNI 提供程序作为 DaemonSet 运行,则在其他控制平面节点上不需要此步骤。
@@ -414,18 +395,27 @@ sudo kubeadm upgrade apply
{{< tabs name="k8s_install_kubelet" >}}
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
# 用最新的补丁版本替换 1.18.x-00 中的 x
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
apt-mark hold kubelet kubectl
-
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
```shell
# 用最新的补丁版本替换 1.18.x-00 中的 x
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
apt-mark hold kubelet kubectl
```
apt-get 的 1.1 版本开始,你也可以使用下面的方法:
```shell
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
```
{{% /tab %}}
{{% tab name="CentOS、RHEL 或 Fedora" %}}
# 用最新的补丁版本替换 1.18.x-00 中的 x
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
用最新的补丁版本替换 1.18.x-00 中的 x
```shell
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
```
{{% /tab %}}
{{< /tabs >}}
@@ -456,36 +446,33 @@ without compromising the minimum required capacity for running your workloads.
<!--
- Upgrade kubeadm on all worker nodes:
{{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
{{% tab name="Ubuntu, Debian or HypriotOS" %}}
# replace x in 1.18.x-00 with the latest patch version
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
# replace x in 1.18.x-0 with the latest patch version
yum install -y kubeadm-1.18.x-0 -disableexcludes=kubernetes
{{% /tab %}}
{{< /tabs >}}
-->
- 在所有工作节点升级 kubeadm:
{{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
-
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.18.x-00
```shell
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.x-00 && \
apt-mark hold kubeadm
```
从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
```shell
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.18.x-00
```
{{% /tab %}}
{{% tab name="CentOS、RHEL 或 Fedora" %}}
# 用最新的补丁版本替换 1.18.x-00 中的 x
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
```shell
# 用最新的补丁版本替换 1.18.x-00 中的 x
yum install -y kubeadm-1.18.x-0 --disableexcludes=kubernetes
```
{{% /tab %}}
{{< /tabs >}}
@@ -557,18 +544,29 @@ without compromising the minimum required capacity for running your workloads.
{{< tabs name="k8s_kubelet_and_kubectl" >}}
{{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
apt-mark hold kubelet kubectl
-
# 从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
```shell
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.x-00 kubectl=1.18.x-00 && \
apt-mark hold kubelet kubectl
```
从 apt-get 的 1.1 版本开始,你也可以使用下面的方法:
```
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.18.x-00 kubectl=1.18.x-00
```
{{% /tab %}}
{{% tab name="CentOS, RHEL or Fedora" %}}
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
```shell
# 将 1.18.x-00 中的 x 替换为最新的补丁版本
yum install -y kubelet-1.18.x-0 kubectl-1.18.x-0 --disableexcludes=kubernetes
```
{{% /tab %}}
{{< /tabs >}}
@@ -601,10 +599,10 @@ without compromising the minimum required capacity for running your workloads.
-->
- 通过将节点标记为可调度,让节点重新上线:
```shell
# 将 <node-to-drain> 替换为当前节点的名称
kubectl uncordon <node-to-drain>
```
```shell
# 将 <node-to-drain> 替换为当前节点的名称
kubectl uncordon <node-to-drain>
```
<!--
## Verify the status of the cluster
@@ -638,9 +636,9 @@ To recover from a bad state, you can also run `kubeadm upgrade --force` without
-->
## 从故障状态恢复
如果 `kubeadm upgrade` 失败并且没有回滚,例如由于执行期间意外关闭,可以再次运行 `kubeadm upgrade`。
此命令是幂等的,并最终确保实际状态是声明的所需状态。
要从故障状态恢复,还可以运行 `kubeadm upgrade --force` 而不去更改集群正在运行的版本。
如果 `kubeadm upgrade` 失败并且没有回滚,例如由于执行期间意外关闭,可以再次运行 `kubeadm upgrade`。
此命令是幂等的,并最终确保实际状态是声明的所需状态。
要从故障状态恢复,还可以运行 `kubeadm upgrade --force` 而不去更改集群正在运行的版本。
<!--
During upgrade kubeadm writes the following backup folders under `/etc/kubernetes/tmp`:
@@ -690,7 +688,7 @@ and post-upgrade manifest file for a certain component, a backup file for it wil
`kubeadm upgrade apply` 做了以下工作:
- 检查的集群是否处于可升级状态:
- 检查的集群是否处于可升级状态:
- API 服务器是可访问的
- 所有节点处于 `Ready` 状态
- 控制面是健康的
@@ -1,53 +1,38 @@
---
reviewers:
- caseydavenport
title: 使用 Calico 作为 NetworkPolicy
title: 使用 Calico 提供 NetworkPolicy
content_type: task
weight: 10
---
<!-- overview -->
<!-- This page shows a couple of quick ways to create a Calico cluster on Kubernetes. -->
本页展示了两种在 Kubernetes 上快速创建 Calico 集群的方法。
<!--
This page shows a couple of quick ways to create a Calico cluster on Kubernetes.
-->
本页展示了几种在 Kubernetes 上快速创建 Calico 集群的方法。
## {{% heading "prerequisites" %}}
<!-- Decide whether you want to deploy a [cloud](#creating-a-calico-cluster-with-google-kubernetes-engine-gke) or [local](#creating-a-local-calico-cluster-with-kubeadm) cluster. -->
决定您想部署一个[](#在-Google-Kubernetes-Engine-GKE-上创建一个-Calico-集群) 还是 [本地](#使用-kubeadm-创建一个本地-Calico-集群) 集群。
<!--
Decide whether you want to deploy a [cloud](#creating-a-calico-cluster-with-google-kubernetes-engine-gke) or [local](#creating-a-local-calico-cluster-with-kubeadm) cluster.
-->
确定你想部署一个[云版本](#gke-cluster)还是[本地版本](#local-cluster)的集群。
<!-- steps -->
<!-- ## Creating a Calico cluster with Google Kubernetes Engine (GKE)
<!--
## Creating a Calico cluster with Google Kubernetes Engine (GKE)
**Prerequisite**: [gcloud](https://cloud.google.com/sdk/docs/quickstarts).
1. To launch a GKE cluster with Calico, just include the `--enable-network-policy` flag.
**Syntax**
```shell
gcloud container clusters create [CLUSTER_NAME] --enable-network-policy
```
**Example**
```shell
gcloud container clusters create my-calico-cluster --enable-network-policy
```
1. To verify the deployment, use the following command.
```shell
kubectl get pods --namespace=kube-system
```
The Calico pods begin with `calico`. Check to make sure each one has a status of `Running`.
-->
## 在 Google Kubernetes Engine (GKE) 上创建一个 Calico 集群
-->
## 在 Google Kubernetes Engine (GKE) 上创建一个 Calico 集群 {#gke-cluster}
**先决条件**: [gcloud](https://cloud.google.com/sdk/docs/quickstarts)
1. 启动一个带有 Calico 的 GKE 集群,只需加上flag `--enable-network-policy`。
<!--
1. To launch a GKE cluster with Calico, just include the `--enable-network-policy` flag.
-->
1. To launch a GKE cluster with Calico, just include the `--enable-network-policy` flag.
1. 启动一个带有 Calico 的 GKE 集群,只需加上参数 `--enable-network-policy`
**语法**
```shell
@@ -59,33 +44,36 @@ weight: 10
gcloud container clusters create my-calico-cluster --enable-network-policy
```
1. 使用如下命令验证部署是否正确。
<!--
1. To verify the deployment, use the following command.
-->
2. 使用如下命令验证部署是否正确。
```shell
kubectl get pods --namespace=kube-system
```
<!--
The Calico pods begin with `calico`. Check to make sure each one has a status of `Running`.
-->
Calico 的 pods 名以 `calico` 打头,检查确认每个 pods 状态为 `Running`。
<!--
<!--
## Creating a local Calico cluster with kubeadm
To get a local single-host Calico cluster in fifteen minutes using kubeadm, refer to the
[Calico Quickstart](https://docs.projectcalico.org/latest/getting-started/kubernetes/).
-->
## 使用 kubeadm 创建一个本地 Calico 集群 {#local-cluster}
## 使用 kubeadm 创建一个本地 Calico 集群
在15分钟内使用 kubeadm 得到一个本地单主机 Calico 集群,请参考
使用 kubeadm 在 15 分钟内得到一个本地单主机 Calico 集群,请参考
[Calico 快速入门](https://docs.projectcalico.org/latest/getting-started/kubernetes/)。
## {{% heading "whatsnext" %}}
<!-- Once your cluster is running, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy. -->
集群运行后,您可以按照 [声明 Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) 去尝试使用 Kubernetes NetworkPolicy
<!--
Once your cluster is running, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy.
-->
集群运行后,您可以按照[声明网络策略](/zh/docs/tasks/administer-cluster/declare-network-policy/)
去尝试使用 Kubernetes NetworkPolicy。
@@ -1,30 +1,25 @@
---
reviewers:
- danwent
title: 使用 Cilium 作为 NetworkPolicy
title: 使用 Cilium 提供 NetworkPolicy
content_type: task
weight: 20
---
<!-- overview -->
<!-- This page shows how to use Cilium for NetworkPolicy.
<!--
This page shows how to use Cilium for NetworkPolicy.
For background on Cilium, read the [Introduction to Cilium](https://cilium.readthedocs.io/en/latest/intro). -->
本页展示如何使用 Cilium 作为 NetworkPolicy。
For background on Cilium, read the [Introduction to Cilium](https://cilium.readthedocs.io/en/latest/intro).
-->
本页展示如何使用 Cilium 提供 NetworkPolicy。
关于 Cilium 的背景知识,请阅读 [Cilium 介绍](https://cilium.readthedocs.io/en/latest/intro)。
## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!-- steps -->
<!--
## Deploying Cilium on Minikube for Basic Testing
@@ -32,32 +27,68 @@ To get familiar with Cilium easily you can follow the
[Cilium Kubernetes Getting Started Guide](https://docs.cilium.io/en/latest/gettingstarted/minikube/)
to perform a basic DaemonSet installation of Cilium in minikube.
Installation in a minikube setup uses a simple ''all-in-one'' YAML
file that includes DaemonSet configurations for Cilium, to connect
to the minikube's etcd instance as well as appropriate RBAC settings:
-->
To start minikube, minimal version required is >= v1.3.1, run the with the
following arguments:
-->
## 在 Minikube 上部署 Cilium 用于基本测试
为了轻松熟悉 Cilium 可以根据[Cilium Kubernetes 入门指南](https://docs.cilium.io/en/latest/gettingstarted/minikube/)在 minikube 中执行一个 cilium 的基本的 DaemonSet 安装。
为了轻松熟悉 Cilium 可以根据
[Cilium Kubernetes 入门指南](https://docs.cilium.io/en/latest/gettingstarted/minikube/)
在 minikube 中执行一个 cilium 的基本 DaemonSet 安装。
minikube 中的安装配置使用一个简单的“一体化” YAML 文件,包括了 Cilium 的 DaemonSet 配置,连接 minikube 的 etcd 实例,以及适当的 RBAC 设置。
要启动 minikube,需要的最低版本为 1.3.1,使用下面的参数运行:
```shell
$ kubectl create -f https://raw.githubusercontent.com/cilium/cilium/master/examples/kubernetes/cilium.yaml
configmap "cilium-config" created
secret "cilium-etcd-secrets" created
serviceaccount "cilium" created
clusterrolebinding "cilium" created
daemonset "cilium" created
clusterrole "cilium" created
minikube version
```
```
minikube version: v1.3.1
```
```shell
minikube start --network-plugin=cni --memory=4096
```
<!--
Mount the BPF filesystem:
-->
挂载 BPF 文件系统:
```shell
minikube ssh -- sudo mount bpffs -t bpf /sys/fs/bpf
```
<!--
For minikube you can deploy this simple ''all-in-one'' YAML file that includes
DaemonSet configurations for Cilium as well as appropriate RBAC settings:
-->
在 minikube 环境中,你可以部署下面的"一体化" YAML 文件,其中包含 Cilium
的 DaemonSet 配置以及适当的 RBAC 配置:
```shell
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/master/examples/kubernetes/cilium.yaml
```
```
configmap/cilium-config created
serviceaccount/cilium created
serviceaccount/cilium-operator created
clusterrole.rbac.authorization.k8s.io/cilium created
clusterrole.rbac.authorization.k8s.io/cilium-operator created
clusterrolebinding.rbac.authorization.k8s.io/cilium created
clusterrolebinding.rbac.authorization.k8s.io/cilium-operator created
daemonset.apps/cilium create
deployment.apps/cilium-operator created
```
<!--
The remainder of the Getting Started Guide explains how to enforce both L3/L4
(i.e., IP address + port) security policies, as well as L7 (e.g., HTTP) security
policies using an example application.
-->
入门指南其余的部分用一个示例应用说明了如何强制执行L3/L4(即 IP 地址+端口)的安全策略以及L7 (如 HTTP)的安全策略。
入门指南其余的部分用一个示例应用说明了如何强制执行 L3/L4(即 IP 地址+端口)的安全策略
以及L7 (如 HTTP)的安全策略。
<!--
## Deploying Cilium for Production Use
@@ -67,14 +98,14 @@ For detailed instructions around deploying Cilium for production, see:
This documentation includes detailed requirements, instructions and example
production DaemonSet files.
-->
## 部署 Cilium 用于生产用途
关于部署 Cilium 用于生产的详细说明,请见[Cilium Kubernetes 安装指南](https://cilium.readthedocs.io/en/latest/gettingstarted/#installation)
,此文档包括详细的需求、说明和生产用途 DaemonSet 文件示例。
关于部署 Cilium 用于生产的详细说明,请见
[Cilium Kubernetes 安装指南](https://cilium.readthedocs.io/en/latest/gettingstarted/#installation)
此文档包括详细的需求、说明和生产用途 DaemonSet 文件示例。
<!-- discussion -->
<!--
## Understanding Cilium components
@@ -83,53 +114,40 @@ this list of Pods run:
-->
## 了解 Cilium 组件
部署使用 Cilium 的集群会添加 Pods 到`kube-system`命名空间。 要查看Pod列表,运行:
部署使用 Cilium 的集群会添加 Pods 到 `kube-system` 命名空间。要查看 Pod 列表,运行:
```shell
kubectl get pods --namespace=kube-system
```
<!-- You'll see a list of Pods similar to this: -->
将看到像这样的 Pods 列表:
将看到像这样的 Pods 列表:
```console
NAME DESIRED CURRENT READY NODE-SELECTOR AGE
cilium 1 1 1 <none> 2m
NAME READY STATUS RESTARTS AGE
cilium-6rxbd 1/1 Running 0 1m
...
```
<!--
There are two main components to be aware of:
- One `cilium` Pod runs on each node in your cluster and enforces network policy
A `cilium` Pod runs on each node in your cluster and enforces network policy
on the traffic to/from Pods on that node using Linux BPF.
- For production deployments, Cilium should leverage the key-value store cluster
(e.g., etcd) used by Kubernetes, which typically runs on the Kubernetes master nodes.
The [Cilium Kubernetes Installation Guide](https://cilium.readthedocs.io/en/latest/gettingstarted/#installation)
includes an example DaemonSet which can be customized to point to this key-value
store cluster. The simple ''all-in-one'' DaemonSet for minikube requires no such
configuration because it automatically connects to the minikube's etcd instance.
-->
有两个主要组件需要注意:
- 在集群中的每个节点上都会运行一个 `cilium` Pod,并利用Linux BPF执行网络策略管理该节点上进出 Pod 的流量。
- 对于生产部署,Cilium 应该复用 Kubernetes 所使用的键值存储集群(如 etcd),其通常在Kubernetes 的 master 节点上运行。
[Cilium Kubernetes安装指南](https://cilium.readthedocs.io/en/latest/gettingstarted/#installation)
包括了一个示例 DaemonSet,可以自定义指定此键值存储集群。
简单的 minikube 的“一体化” DaemonSet 不需要这样的配置,因为它会自动连接到 minikube 的 etcd 实例。
-->
你的集群中的每个节点上都会运行一个 `cilium` Pod,通过使用 Linux BPF
针对该节点上的 Pod 的入站、出站流量实施网络策略控制。
## {{% heading "whatsnext" %}}
<!-- Once your cluster is running, you can follow the
<!--
Once your cluster is running, you can follow the
[Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/)
to try out Kubernetes NetworkPolicy with Cilium.
Have fun, and if you have questions, contact us using the
[Cilium Slack Channel](https://cilium.herokuapp.com/). -->
群集运行后,您可以按照[声明网络策略](/docs/tasks/administer-cluster/declare-network-policy/)
用 Cilium 试用 Kubernetes NetworkPolicy。
玩得开心,如果您有任何疑问,请联系我们
[Cilium Slack Channel](https://cilium.herokuapp.com/)
[Cilium Slack Channel](https://cilium.herokuapp.com/).
-->
集群运行后,你可以按照
[声明网络策略](/zh/docs/tasks/administer-cluster/declare-network-policy/)
试用基于 Cilium 的 Kubernetes NetworkPolicy
玩得开心,如果你有任何疑问,请到 [Cilium Slack 频道](https://cilium.herokuapp.com/)
联系我们。
@@ -1,33 +1,42 @@
---
reviewers:
- murali-reddy
title: 使用 Kube-router 作为 NetworkPolicy
title: 使用 kube-router 提供 NetworkPolicy
content_type: task
weight: 30
---
<!-- overview -->
<!-- This page shows how to use [Kube-router](https://github.com/cloudnativelabs/kube-router) for NetworkPolicy. -->
本页展示了如何使用 [Kube-router](https://github.com/cloudnativelabs/kube-router) 作为 NetworkPolicy
<!--
This page shows how to use [Kube-router](https://github.com/cloudnativelabs/kube-router) for NetworkPolicy.
-->
本页展示如何使用 [Kube-router](https://github.com/cloudnativelabs/kube-router) 提供 NetworkPolicy。
## {{% heading "prerequisites" %}}
<!-- You need to have a Kubernetes cluster running. If you do not already have a cluster, you can create one by using any of the cluster installers like Kops, Bootkube, Kubeadm etc. -->
您需要拥有一个正在运行的 Kubernetes 集群。如果您还没有集群,可以使用任意的集群安装器如 Kops,BootkubeKubeadm 等创建一个。
<!--
You need to have a Kubernetes cluster running. If you do not already have a cluster, you can create one by using any of the cluster installers like Kops, Bootkube, Kubeadm etc.
-->
你需要拥有一个运行中的 Kubernetes 集群。如果你还没有集群,可以使用任意的集群
安装程序如 Kops、Bootkube、Kubeadm 等创建一个。
<!-- steps -->
<!-- ## Installing Kube-router addon
The Kube-router Addon comes with a Network Policy Controller that watches Kubernetes API server for any NetworkPolicy and pods updated and configures iptables rules and ipsets to allow or block traffic as directed by the policies. Please follow the [trying Kube-router with cluster installers](https://www.kube-router.io/docs/user-guide/#try-kube-router-with-cluster-installers) guide to install Kube-router addon. -->
<!--
## Installing Kube-router addon
## 安装 Kube-router 插件
Kube-router 插件自带一个Network Policy 控制器,监视来自于Kubernetes API server 的 NetworkPolicy 和 pods 的变化,根据策略指示配置 iptables 规则和 ipsets 来允许或阻止流量。请根据 [尝试通过集群安装器使用 Kube-router](https://www.kube-router.io/docs/user-guide/#try-kube-router-with-cluster-installers) 指南安装 Kube-router 插件。
The Kube-router Addon comes with a Network Policy Controller that watches Kubernetes API server for any NetworkPolicy and pods updated and configures iptables rules and ipsets to allow or block traffic as directed by the policies. Please follow the [trying Kube-router with cluster installers](https://www.kube-router.io/docs/user-guide/#try-kube-router-with-cluster-installers) guide to install Kube-router addon.
-->
## 安装 kube-router 插件
kube-router 插件自带一个网络策略控制器,监视来自于 Kubernetes API 服务器的
NetworkPolicy 和 Pod 的变化,根据策略指示配置 iptables 规则和 ipsets 来允许或阻止流量。
请根据 [通过集群安装程序尝试 kube-router](https://www.kube-router.io/docs/user-guide/#try-kube-router-with-cluster-installers) 指南安装 kube-router 插件。
## {{% heading "whatsnext" %}}
<!-- Once you have installed the Kube-router addon, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy. -->
在您安装 Kube-router 插件后,可以根据 [声明 Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) 去尝试使用 Kubernetes NetworkPolicy
<!--
Once you have installed the Kube-router addon, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy.
-->
在你安装了 kube-router 插件后,可以参考
[声明网络策略](/zh/docs/tasks/administer-cluster/declare-network-policy/)
去尝试使用 Kubernetes NetworkPolicy。
@@ -1,7 +1,5 @@
---
reviewers:
- chrismarino
title: 使用 Romana 作为 NetworkPolicy
title: 使用 Romana 提供 NetworkPolicy
content_type: task
weight: 40
---
@@ -11,15 +9,10 @@ weight: 40
<!-- This page shows how to use Romana for NetworkPolicy. -->
本页展示如何使用 Romana 作为 NetworkPolicy。
## {{% heading "prerequisites" %}}
<!-- Complete steps 1, 2, and 3 of the [kubeadm getting started guide](/docs/getting-started-guides/kubeadm/). -->
完成[kubeadm 入门指南](/docs/getting-started-guides/kubeadm/)中的1、2、3步。
完成 [kubeadm 入门指南](/zh/docs/reference/setup-tools/kubeadm/kubeadm/)中的 1、2、3 步。
<!-- steps -->
<!--
@@ -37,23 +30,22 @@ To apply network policies use one of the following:
-->
## 使用 kubeadm 安装 Romana
按照[容器化安装指南](https://github.com/romana/romana/tree/master/containerize)获取 kubeadm。
按照[容器化安装指南](https://github.com/romana/romana/tree/master/containerize),使用 kubeadm 安装
## 用网络策略
## 用网络策略
使用以下的一种方式去运用网络策略:
使用以下的一种方式用网络策略:
* [Romana 网络策略](https://github.com/romana/romana/wiki/Romana-policies)
* [Romana 网络策略例子](https://github.com/romana/core/blob/master/doc/policy.md)
* NetworkPolicy API
## {{% heading "whatsnext" %}}
<!--
Once you have installed Romana, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy.
-->
Romana 安装完成后,可以按照[声明 Network Policy](/docs/tasks/administer-cluster/declare-network-policy/)去尝试使用 Kubernetes NetworkPolicy。
Romana 安装完成后,可以按照
[声明网络策略](/zh/docs/tasks/administer-cluster/declare-network-policy/)
去尝试使用 Kubernetes NetworkPolicy。
@@ -1,28 +1,28 @@
---
reviewers:
- bboreham
title: 使用 Weave Net 作为 NetworkPolicy
title: 使用 Weave Net 提供 NetworkPolicy
content_type: task
weight: 50
---
<!-- overview -->
<!-- This page shows how to use Weave Net for NetworkPolicy. -->
本页展示了如何使用使用 Weave Net 作为 NetworkPolicy。
<!--
This page shows how to use Weave Net for NetworkPolicy.
-->
本页展示如何使用使用 Weave Net 提供 NetworkPolicy。
## {{% heading "prerequisites" %}}
<!--
You need to have a Kubernetes cluster. Follow the [kubeadm getting started guide](/docs/getting-started-guides/kubeadm/) to bootstrap one.
-->
需要拥有一个 Kubernetes 集群。按照[kubeadm 入门指南](/docs/getting-started-guides/kubeadm/)来引导一个。
需要拥有一个 Kubernetes 集群。按照
[kubeadm 入门指南](/zh/docs/reference/setup-tools/kubeadm/kubeadm/)
来启动一个。
<!-- steps -->
<!--
## Install the Weave Net addon
@@ -32,20 +32,21 @@ The Weave Net addon for Kubernetes comes with a [Network Policy Controller](http
-->
## 安装 Weave Net 插件
按照[通过插件集成Kubernetes](https://www.weave.works/docs/net/latest/kube-addon/)指南。
按照[通过插件集成 Kubernetes](https://www.weave.works/docs/net/latest/kube-addon/)
指南执行安装。
Kubernetes 的 Weave Net 插件带有[网络策略控制器](https://www.weave.works/docs/net/latest/kube-addon/#npc),可自动监控 Kubernetes 所有名称空间中的任何 NetworkPolicy 注释。 配置`iptables`规则以允许或阻止策略指示的流量。
Kubernetes 的 Weave Net 插件带有
[网络策略控制器](https://www.weave.works/docs/net/latest/kube-addon/#npc)
可自动监控 Kubernetes 所有名字空间的 NetworkPolicy 注释,
配置 `iptables` 规则以允许或阻止策略指示的流量。
<!--
## Test the installation
Verify that the weave works.
Enter the following command:
-->
## 测试安装
验证 weave 是否有效。
@@ -67,17 +68,21 @@ weave-net-7nmwt 2/2 Running 3 9d
weave-net-pmw8w 2/2 Running 0 9d 192.168.2.216 worknode2
```
<!-- Each Node has a weave Pod, and all Pods are `Running` and `2/2 READY`. (`2/2` means that each Pod has `weave` and `weave-npc`.) -->
每个 Node 都有一个 weave Pod,所有 Pod 都是`Running``2/2 READY`。(`2/2`表示每个Pod都有`weave``weave-npc`。)
<!--
Each Node has a weave Pod, and all Pods are `Running` and `2/2 READY`. (`2/2` means that each Pod has `weave` and `weave-npc`.)
-->
每个 Node 都有一个 weave Pod,所有 Pod 都是`Running``2/2 READY`
`2/2` 表示每个 Pod 都有 `weave``weave-npc`
## {{% heading "whatsnext" %}}
<!--
Once you have installed the Weave Net addon, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy. If you have any question, contact us at [#weave-community on Slack or Weave User Group](https://github.com/weaveworks/weave#getting-help).
-->
安装Weave Net插件后,您可以按照[声明网络策略](/docs/tasks/administration-cluster/declare-network-policy/)来试用 Kubernetes NetworkPolicy。 如果您有任何疑问,请联系我们[#weave-community on Slack 或 Weave User Group](https://github.com/weaveworks/weave#getting-help)。
安装 Weave Net 插件后,你可以参考
[声明网络策略](/zh/docs/tasks/administration-cluster/declare-network-policy/)
来试用 Kubernetes NetworkPolicy。
如果你有任何疑问,请通过
[Slack 上的 #weave-community 频道或者 Weave 用户组](https://github.com/weaveworks/weave#getting-help)
联系我们。