@@ -31,7 +31,7 @@ plane hosts. If you do not already have a cluster, you can create one by using
31
31
32
32
The following steps require an egress configuration, for example:
33
33
-->
34
- ## 配置 Konnectivity 服务
34
+ ## 配置 Konnectivity 服务 {#configure-the-konnectivity-service}
35
35
36
36
接下来的步骤需要出口配置,比如:
37
37
@@ -48,29 +48,16 @@ feature enabled in your cluster. It is enabled by default since Kubernetes v1.20
48
48
1. Set the `--egress-selector-config-file` flag of the API Server to the path of
49
49
your API Server egress configuration file.
50
50
1. If you use UDS connection, add volumes config to the kube-apiserver:
51
- ```yaml
52
- spec:
53
- containers:
54
- volumeMounts:
55
- - name: konnectivity-uds
56
- mountPath: /etc/kubernetes/konnectivity-server
57
- readOnly: false
58
- volumes:
59
- - name: konnectivity-uds
60
- hostPath:
61
- path: /etc/kubernetes/konnectivity-server
62
- type: DirectoryOrCreate
63
- ```
64
51
-->
65
52
你需要配置 API 服务器来使用 Konnectivity 服务,并将网络流量定向到集群节点:
66
53
67
- 确保[ 服务账号令牌卷投射] ( /zh-cn/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection )
68
- 特性被启用。该特性自 Kubernetes v1.20 起默认已被启用。
69
-
54
+ 1 . 确保[ 服务账号令牌卷投射] ( /zh-cn/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection ) 特性被启用。
55
+ 该特性自 Kubernetes v1.20 起默认已被启用。
70
56
1 . 创建一个出站流量配置文件,比如 ` admin/konnectivity/egress-selector-configuration.yaml ` 。
71
- 1 . 将 API 服务器的 ` --egress-selector-config-file ` 参数设置为你的 API 服务器的
72
- 离站流量配置文件路径 。
57
+ 1 . 将 API 服务器的 ` --egress-selector-config-file ` 参数设置为你的 API
58
+ 服务器的离站流量配置文件路径 。
73
59
1 . 如果你在使用 UDS 连接,须将卷配置添加到 kube-apiserver:
60
+
74
61
``` yaml
75
62
spec :
76
63
containers :
@@ -92,11 +79,10 @@ using the cluster CA certificate `/etc/kubernetes/pki/ca.crt` from a control-pla
92
79
-->
93
80
为 konnectivity-server 生成或者取得证书和 kubeconfig 文件。
94
81
例如,你可以使用 OpenSSL 命令行工具,基于存放在某控制面主机上
95
- ` /etc/kubernetes/pki/ca.crt` 文件中的集群 CA 证书来
96
- 发放一个 X.509 证书,
82
+ ` /etc/kubernetes/pki/ca.crt` 文件中的集群 CA 证书来发放一个 X.509 证书。
97
83
98
84
` ` ` bash
99
- openssl req -subj "/CN=system:konnectivity-server" -new -newkey rsa:2048 -nodes -out konnectivity.csr -keyout konnectivity.key -out konnectivity.csr
85
+ openssl req -subj "/CN=system:konnectivity-server" -new -newkey rsa:2048 -nodes -out konnectivity.csr -keyout konnectivity.key
100
86
openssl x509 -req -in konnectivity.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out konnectivity.crt -days 375 -sha256
101
87
SERVER=$(kubectl config view -o jsonpath='{.clusters..server}')
102
88
kubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-credentials system:konnectivity-server --client-certificate konnectivity.crt --client-key konnectivity.key --embed-certs=true
0 commit comments