docs:add OKG network plugin: JdCloud-NLB 、JdCloud-EIP (#218)

* docs:add OKG network plugin: JdCloud-NLB 、JdCloud-EIP

Signed-off-by: hhr <691129301@qq.com>

* docs:add OKG network plugin: JdCloud-NLB 、JdCloud-EIP

Signed-off-by: hhr <691129301@qq.com>

* fix yaml example

Signed-off-by: hhr <691129301@qq.com>

* fix md format

Signed-off-by: hhr <691129301@qq.com>

---------

Signed-off-by: hhr <691129301@qq.com>
This commit is contained in:
hhr 2024-12-10 09:30:15 +08:00 committed by GitHub
parent d8417a85cf
commit 33858a2499
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 402 additions and 0 deletions

View File

@ -21,6 +21,8 @@ OKG 会集成不同云提供商的不同网络插件用户可通过GameServer
- Volcengine-CLB
- AmazonWebServices-NLB
- TencentCloud-CLB
- JdCloud-NLB
- JdCloud-EIP
---
### Kubernetes-HostPort
@ -1512,6 +1514,204 @@ spec:
networkType: TencentCloud-CLB
```
---
### JdCloud-NLB
#### 插件名称
`JdCloud-NLB`
#### Cloud Provider
JdCloud
#### 插件说明
京东云容器服务支持在k8s中对NLB复用的机制不同的svc可以使用同一个NLB的不同端口。由此JdCloud-NLB network plugin将记录各NLB对应的端口分配情况对于指定了网络类型为JdCloud-NLBJdCloud-NLB网络插件将会自动分配一个端口并创建一个service对象待检测到svc公网IP创建成功后GameServer的网络变为Ready状态该过程执行完成。
#### 网络参数
NlbIds
- 含义填写nlb的id可填写多个需要先在【京东云】中创建好nlb。
- 填写格式各个nlbId用,分割。例如netlb-aaa,netlb-bbb,...
- 是否支持变更:是
PortProtocols
- 含义pod暴露的端口及协议支持填写多个端口/协议
- 填写格式port1/protocol1,port2/protocol2,...(协议需大写)
- 是否支持变更:是
Fixed
- 含义是否固定访问IP/端口。若是即使pod删除重建网络内外映射关系不会改变
- 填写格式false / true
- 是否支持变更:是
#### 插件配置
```toml
[jdcloud]
enable = true
[jdcloud.nlb]
#填写nlb可使用的空闲端口段用于为pod分配外部接入端口范围最大为200
max_port = 700
min_port = 500
```
#### 示例说明
```yaml
apiVersion: game.kruise.io/v1alpha1
kind: GameServerSet
metadata:
name: nlb
namespace: default
spec:
replicas: 3
updateStrategy:
rollingUpdate:
podUpdatePolicy: InPlaceIfPossible
network:
networkType: JdCloud-NLB
networkConf:
- name: NlbIds
#Fill in Jdcloud Cloud LoadBalancer Id here
value: netlb-xxxxx
- name: PortProtocols
#Fill in the exposed ports and their corresponding protocols here.
#If there are multiple ports, the format is as follows: {port1}/{protocol1},{port2}/{protocol2}...
#If the protocol is not filled in, the default is TCP
value: 80/TCP
- name: AllocateLoadBalancerNodePorts
# Whether the generated service is assigned nodeport.
value: "true"
- name: Fixed
#Fill in here whether a fixed IP is required [optional] ; Default is false
value: "false"
- name: Annotations
#Fill in the anno related to clb on the service
#The format is as follows: {key1}:{value1},{key2}:{value2}...
value: "key1:value1,key2:value2"
gameServerTemplate:
spec:
containers:
- args:
- /data/server/start.sh
command:
- /bin/bash
image: gss-cn-north-1.jcr.service.jdcloud.com/gsshosting/pal:v1
name: game-server
```
生成的 gameserver nlb-0 networkStatus 字段如下所示:
```yaml
networkStatus:
createTime: "2024-11-04T08:00:20Z"
currentNetworkState: Ready
desiredNetworkState: Ready
externalAddresses:
- ip: xxx.xxx.xxx.xxx
ports:
- name: "8211"
port: 531
protocol: UDP
internalAddresses:
- ip: 10.0.0.95
ports:
- name: "8211"
port: 8211
protocol: UDP
lastTransitionTime: "2024-11-04T08:00:20Z"
networkType: JdCloud-NLB
```
---
### JdCloud-EIP
#### 插件名称
`JdCloud-EIP`
#### Cloud Provider
JdCloud
#### 插件说明
京东云容器服务支持在k8s中让一个 pod 和弹性公网 IP 直接进行绑定,可以让 pod 直接与外部网络进行通信。
- 集群的网络插件使用 yunjian-CNI不可使用 flannel 创建集群
- 弹性公网 IP 使用限制请具体参考京东云弹性公网 IP 产品文档
- 安装 EIP-Controller 组件
- 弹性公网 IP 不会随 POD 的销毁而删除
#### 网络参数
BandwidthConfigName
- 含义弹性公网IP的带宽单位为 Mbps取值范围为 [1,1024]
- 填写格式:必须填整数,且不带单位
- 是否支持变更:是
ChargeTypeConfigName
- 含义弹性公网IP的计费方式取值按量计费postpaid_by_usage包年包月postpaid_by_duration
- 填写格式:字符串
- 是否支持变更:是
FixedEIPConfigName
- 含义是否固定弹性公网IP。若是即使pod删除重建弹性公网IP也不会改变
- 填写格式:"false" / "true",字符串
- 是否支持变更:是
AssignEIPConfigName
- 含义是否指定使用某个弹性公网IP请填写 true否则自动分配一个EIP
- 填写格式:"false" / "true",字符串
EIPIdConfigName
- 含义若指定使用某个弹性公网IP则必须填写弹性公网IP的ID组件会自动进行进行查询和绑定
- 填写格式字符串例如fip-xxxxxxxx
#### 示例说明
```yaml
apiVersion: game.kruise.io/v1alpha1
kind: GameServerSet
metadata:
name: eip
namespace: default
spec:
gameServerTemplate:
spec:
containers:
- image: gss-cn-north-1.jcr.service.jdcloud.com/gsshosting/pal:v1
name: game-server
network:
networkType: JdCloud-EIP
networkConf:
- name: "BandWidth"
value: "10"
- name: "ChargeType"
value: postpaid_by_usage
- name: "Fixed"
value: "false"
replicas: 3
```
生成的 gameserver eip-0 networkStatus 字段如下所示:
```yaml
networkStatus:
createTime: "2024-11-04T10:53:14Z"
currentNetworkState: Ready
desiredNetworkState: Ready
externalAddresses:
- ip: xxx.xxx.xxx.xxx
internalAddresses:
- ip: 10.0.0.95
lastTransitionTime: "2024-11-04T10:53:14Z"
networkType: JdCloud-EIP
```
## 网络隔离
考虑以下场景,如:

View File

@ -21,6 +21,8 @@ OpenKruiseGame supports the following network plugins:
- Volcengine-CLB
- AmazonWebServices-NLB
- TencentCloud-CLB
- JdCloud-NLB
- JdCloud-EIP
---
### Kubernetes-HostPort
@ -1482,6 +1484,206 @@ The network status of GameServer would be as follows:
networkType: TencentCloud-CLB
```
---
### JdCloud-NLB
#### Plugin name
`JdCloud-NLB`
#### Cloud Provider
JDCloud
#### Plugin description
JdCloud Container Service supports the reuse of NLB (Network Load Balancer) in Kubernetes. Different services (svcs) can use different ports of the same NLB. As a result, the JdCloud-NLB network plugin will record the port allocation for each NLB. For services that specify the network type as JdCloud-NLB, the JdCloud-NLB network plugin will automatically allocate a port and create a service object. Once it detects that the public IP of the svc has been successfully created, the GameServer's network will transition to the Ready state, completing the process.
#### Network parameters
NlbIds
- Meaningfill in the id of the clb. You can fill in more than one. You need to create the clb in [JdCloud].
- Valueeach clbId is divided by `,` . For example`netlb-aaa,netlb-bbb,...`
- ConfigurableY
PortProtocols
- Meaningthe ports and protocols exposed by the pod, support filling in multiple ports/protocols
- Value`port1/protocol1`,`port2/protocol2`,... The protocol names must be in uppercase letters.
- ConfigurableY
Fixed
- Meaningwhether the mapping relationship is fixed. If the mapping relationship is fixed, the mapping relationship remains unchanged even if the pod is deleted and recreated.
- Valuefalse / true
- ConfigurableY
#### Plugin configuration
```toml
[jdcloud]
enable = true
[jdcloud.nlb]
#To allocate external access ports for Pods, you need to define the idle port ranges that the NLB (Network Load Balancer) can use. The maximum range for each port segment is 200 ports.
max_port = 700
min_port = 500
```
#### Example
```yaml
apiVersion: game.kruise.io/v1alpha1
kind: GameServerSet
metadata:
name: nlb
namespace: default
spec:
replicas: 3
updateStrategy:
rollingUpdate:
podUpdatePolicy: InPlaceIfPossible
network:
networkType: JdCloud-NLB
networkConf:
- name: NlbIds
#Fill in Jdcloud Cloud LoadBalancer Id here
value: netlb-xxxxx
- name: PortProtocols
#Fill in the exposed ports and their corresponding protocols here.
#If there are multiple ports, the format is as follows: {port1}/{protocol1},{port2}/{protocol2}...
#If the protocol is not filled in, the default is TCP
value: 80/TCP
- name: AllocateLoadBalancerNodePorts
# Whether the generated service is assigned nodeport.
value: "true"
- name: Fixed
#Fill in here whether a fixed IP is required [optional] ; Default is false
value: "false"
- name: Annotations
#Fill in the anno related to clb on the service
#The format is as follows: {key1}:{value1},{key2}:{value2}...
value: "key1:value1,key2:value2"
gameServerTemplate:
spec:
containers:
- args:
- /data/server/start.sh
command:
- /bin/bash
image: gss-cn-north-1.jcr.service.jdcloud.com/gsshosting/pal:v1
name: game-server
```
The network status of GameServer would be as follows:
```yaml
networkStatus:
createTime: "2024-11-04T08:00:20Z"
currentNetworkState: Ready
desiredNetworkState: Ready
externalAddresses:
- ip: xxx.xxx.xxx.xxx
ports:
- name: "8211"
port: 531
protocol: UDP
internalAddresses:
- ip: 10.0.0.95
ports:
- name: "8211"
port: 8211
protocol: UDP
lastTransitionTime: "2024-11-04T08:00:20Z"
networkType: JdCloud-NLB
```
---
### JdCloud-EIP
#### Plugin name
`JdCloud-EIP`
#### Cloud Provider
JDCloud
#### Plugin description
JdCloud Container Service supports binding an Elastic Public IP directly to a pod in Kubernetes, allowing the pod to communicate directly with the external network.
- The cluster's network plugin uses Yunjian-CNI and cannot use Flannel to create the cluster.
- For specific usage restrictions of Elastic Public IPs, please refer to the JdCloud Elastic Public IP product documentation.
- Install the EIP-Controller component.
- The Elastic Public IP will not be deleted when the pod is destroyed.
#### Network parameters
BandwidthConfigName
- MeaningThe bandwidth of the Elastic Public IP, measured in Mbps, has a value range of [1, 1024].
- ValueMust be an integer
- ConfigurableY
ChargeTypeConfigName
- MeaningThe billing method for the Elastic Public IP
- Valuestring, `postpaid_by_usage`/`postpaid_by_duration`
- ConfigurableY
FixedEIPConfigName
- MeaningWhether to fixed the Elastic Public IP,if so, the EIP will not be changed when the pod is recreated.
- Valuestring, "false" / "true"
- ConfigurableY
AssignEIPConfigName
- MeaningWhether to designate a specific Elastic Public IP. If true, provide the ID of the Elastic Public IP; otherwise, an EIP will be automatically allocated.
- Valuestring, "false" / "true"
EIPIdConfigName
- MeaningIf a specific Elastic Public IP is designated, the ID of the Elastic Public IP must be provided, and the component will automatically perform the lookup and binding.
- Valuestringfor example`fip-xxxxxxxx`
#### Example
```yaml
apiVersion: game.kruise.io/v1alpha1
kind: GameServerSet
metadata:
name: eip
namespace: default
spec:
gameServerTemplate:
spec:
containers:
- image: gss-cn-north-1.jcr.service.jdcloud.com/gsshosting/pal:v1
name: game-server
network:
networkType: JdCloud-EIP
networkConf:
- name: "BandWidth"
value: "10"
- name: "ChargeType"
value: postpaid_by_usage
- name: "Fixed"
value: "false"
replicas: 3
```
Check the network status in GameServer:
```yaml
networkStatus:
createTime: "2024-11-04T10:53:14Z"
currentNetworkState: Ready
desiredNetworkState: Ready
externalAddresses:
- ip: xxx.xxx.xxx.xxx
internalAddresses:
- ip: 10.0.0.95
lastTransitionTime: "2024-11-04T10:53:14Z"
networkType: JdCloud-EIP
```
## Network Isolation
Consider the following scenarios, such as: