Skip to content

Commit

Permalink
docs:add OKG network plugin: JdCloud-NLB 、JdCloud-EIP (#218)
Browse files Browse the repository at this point in the history
* docs:add OKG network plugin: JdCloud-NLB 、JdCloud-EIP

Signed-off-by: hhr <[email protected]>

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

Signed-off-by: hhr <[email protected]>

* fix yaml example

Signed-off-by: hhr <[email protected]>

* fix md format

Signed-off-by: hhr <[email protected]>

---------

Signed-off-by: hhr <[email protected]>
  • Loading branch information
hhr0815hhr authored Dec 10, 2024
1 parent d8417a8 commit 33858a2
Show file tree
Hide file tree
Showing 2 changed files with 402 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ OKG 会集成不同云提供商的不同网络插件,用户可通过GameServer
- Volcengine-CLB
- AmazonWebServices-NLB
- TencentCloud-CLB
- JdCloud-NLB
- JdCloud-EIP

---
### Kubernetes-HostPort
Expand Down Expand Up @@ -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-NLB,JdCloud-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
```


## 网络隔离

考虑以下场景,如:
Expand Down
Loading

0 comments on commit 33858a2

Please sign in to comment.