kruise-game/cloudprovider/volcengine
lizhipeng629 7136738627
fix old svc remain after pod recreate when using Volcengine-CLB (#233)
feat(*): check pod uid in svc

fix:add pod create time in svc

Co-authored-by: 李志朋 <lizhipeng.629@bytedance.com>
2025-06-06 17:00:09 +08:00
..
README.md enhance: add AllocateLoadBalancerNodePorts in clb plugin (#141) 2024-04-26 11:24:00 +08:00
README.zh_CN.md enhance: add AllocateLoadBalancerNodePorts in clb plugin (#141) 2024-04-26 11:24:00 +08:00
clb.go fix old svc remain after pod recreate when using Volcengine-CLB (#233) 2025-06-06 17:00:09 +08:00
clb_test.go fix:add block port in volc engine (#182) 2024-11-12 11:11:31 +08:00
eip.go feat(*): add eip provider of VKE (#218) 2025-04-27 15:33:36 +08:00
eip_test.go feat(*): add eip provider of VKE (#218) 2025-04-27 15:33:36 +08:00
volcengine.go feat(*): add volcengine provider and clb plugin (#127) 2024-01-29 16:36:23 +08:00

README.md

English | 中文

The Volcaengine Kubernetes Engine supports the CLB reuse mechanism in k8s. Different SVCs can use different ports of the same CLB. Therefore, the Volcengine-CLB network plugin will record the port allocation corresponding to each CLB. For the specified network type as Volcengine-CLB, the Volcengine-CLB network plugin will automatically allocate a port and create a service object. Wait for the svc ingress field. After the public network IP is successfully created, the GameServer network is in the Ready state and the process is completed. image

Volcengine-CLB configuration

plugin configuration

[volcengine]
enable = true
[volcengine.clb]
#Fill in the free port segment that clb can use to allocate external access ports to pods, The maximum port range is 200.
max_port = 700
min_port = 500

Parameter

ClbIds

  • Meaningfill in the id of the clb. You can fill in more than one. You need to create the clb in [Volcano Engine].
  • Valueeach clbId is divided by , . For example: clb-9zeo7prq1m25ctpfrw1m7,clb-bp1qz7h50yd3w58h2f8je,...
  • ConfigurableY

PortProtocols

  • Meaningthe ports and protocols exposed by the pod, support filling in multiple ports/protocols
  • Valueport1/protocol1,port2/protocol2,... The protocol names must be in uppercase letters.
  • ConfigurableY

AllocateLoadBalancerNodePorts

  • MeaningWhether the generated service is assigned nodeport, this can be set to false only in clb passthrough mode
  • Valuefalse / true
  • 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

AllowNotReadyContainers

  • Meaningthe container names that are allowed not ready when inplace updating, when traffic will not be cut.
  • Value{containerName_0},{containerName_1},... egsidecar
  • ConfigurableIt cannot be changed during the in-place updating process.

Annotations

  • Meaningthe anno added to the service
  • Valuekey1:value1,key2:value2...
  • ConfigurableY

Example

cat <<EOF | kubectl apply -f -
apiVersion: game.kruise.io/v1alpha1
kind: GameServerSet
metadata:
  name: gss-2048-clb
  namespace: default
spec:
  replicas: 3
  updateStrategy:
    rollingUpdate:
      podUpdatePolicy: InPlaceIfPossible
  network:
    networkType: Volcengine-CLB
    networkConf:
      - name: ClbIds
        #Fill in Volcengine Cloud LoadBalancer Id here
        value: clb-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:
        - image: cr-helm2-cn-beijing.cr.volces.com/kruise/2048:v1.0
          name: app-2048
          volumeMounts:
            - name: shared-dir
              mountPath: /var/www/html/js
        - image: cr-helm2-cn-beijing.cr.volces.com/kruise/2048-sidecar:v1.0
          name: sidecar
          args:
            - bash
            - -c
            - rsync -aP /app/js/* /app/scripts/ && while true; do echo 11;sleep 2; done
          volumeMounts:
            - name: shared-dir
              mountPath: /app/scripts
      volumes:
        - name: shared-dir
          emptyDir: {}
EOF

Check the network status in GameServer:

networkStatus:
    createTime: "2024-01-19T08:19:49Z"
    currentNetworkState: Ready
    desiredNetworkState: Ready
    externalAddresses:
    - ip: xxx.xxx.xx.xxx
      ports:
      - name: "80"
        port: 6611
        protocol: TCP
    internalAddresses:
    - ip: 172.16.200.60
      ports:
      - name: "80"
        port: 80
        protocol: TCP
    lastTransitionTime: "2024-01-19T08:19:49Z"
    networkType: Volcengine-CLB