Skip to content

Latest commit

 

History

History
177 lines (176 loc) · 13.8 KB

File metadata and controls

177 lines (176 loc) · 13.8 KB

Usage

The Kubernetes Services support richer L4 cloud load balance(CLB) capabilities through annotations.

Limitation

Can not modify the CLB instances, listeners, or backend server groups maintained by the LoadBalancer type Service on the CLB console, otherwise, the traffic of CLB may become abnormal.

Service annotation list

Key Type Required Explain Default Changeable
service.beta.kubernetes.io/volcengine-loadbalancer-name String NO The name of the CLB to be created. - NO
service.beta.kubernetes.io/volcengine-loadbalancer-id String NO ID of reused CLB. - NO
service.beta.kubernetes.io/volcengine-loadbalancer-pass-through Boolean NO Whether to enable pass through mode. Value:
true: enable. The backends of CLB are enis of Pod.
false: disable. The backends of CLB are NodePorts.
false YES
service.beta.kubernetes.io/volcengine-loadbalancer-subnet-id String YES ID of subnet, which is used to allocate ip for CLB. - NO
service.beta.kubernetes.io/volcengine-loadbalancer-address-type String NO Address type of CLB. Value:
PUBLIC: CLB can be accessed from the public network.
PRIVATE: CLB can only be accessed in VPC.
PUBLIC NO
service.beta.kubernetes.io/volcengine-loadbalancer-isp-type String NO ISP type of PUBLIC type CLB. See EIP document for more details. BGP NO
service.beta.kubernetes.io/volcengine-loadbalancer-billing-type Integer NO Billing type of CLB. Value:
2: Paid by specification of CLB.
3: No need to specify specification of CLB, and will be charged by usage.
2 YES
service.beta.kubernetes.io/volcengine-loadbalancer-eip-billing-type Integer NO Billing type of EIP. Value:
2: Paid by bandwidth.
3: Paid by network traffic usage.
3 NO
service.beta.kubernetes.io/volcengine-loadbalancer-bandwidth Integer NO The peak bandwidth(Mbps) of the CLB. 1 NO
service.beta.kubernetes.io/volcengine-loadbalancer-spec String NO Specification of CLB. Value:
small_1.
small_2.
medium_1.
medium_2.
large_1.
large_2.
See Specification document for more details.
small_1 NO
service.beta.kubernetes.io/volcengine-loadbalancer-sync-fields String NO Whether to update specification of CLB according to the annotation. Value:
spec: update specification of CLB according to loadbalancer-spec.
- NO
service.beta.kubernetes.io/volcengine-loadbalancer-master-zone-id String NO Master zone ID of CLB.
Can not be the same with slave-zone-id.
The zone ID where the subnet is located will be used by default.
See Region and Zone for more details.
- NO
service.beta.kubernetes.io/volcengine-loadbalancer-slave-zone-id String NO Slave zone ID of CLB.
Can not be the same with master-zone-id.
master-zone-id is required when this field is set.
Will be assigned randomly.
- NO
service.beta.kubernetes.io/volcengine-loadbalancer-modification-protection-status String NO Value:
NonProtection: Allows you to modify or delete instances through the console.
ConsoleProtection: forbidden to modify or delete instances through the console.
ConsoleProtection YES
service.beta.kubernetes.io/volcengine-loadbalancer-eip-BandwidthPackageId String NO ID of shared bandwidth package.
Only takes effect when service.beta.kubernetes.io/volcengine-loadbalancer-address-type=PUBLIC.
The original payment type will be overwritten.
- YES
service.beta.kubernetes.io/volcengine-loadbalancer-scheduler String NO Scheduling algorithm of listeners. Value:
wrr.
wlc.
sh.
See Scheduling algorithm for more details.
wrr NO
service.beta.kubernetes.io/volcengine-loadbalancer-health-check-flag String NO Value:
on: enable health check.
off: disable health check.
off YES
service.beta.kubernetes.io/volcengine-loadbalancer-health-check-interval Integer NO Health check interval.Range: 1-300. Unit: seconds. 2 YES
service.beta.kubernetes.io/volcengine-loadbalancer-health-check-connect-timeout Integer NO Health check timeout. Range: 1-60. Unit: seconds. 2 YES
service.beta.kubernetes.io/volcengine-loadbalancer-healthy-threshold Integer NO The number of consecutive successful health checks before the backend server's health check status is changed from Fail to Success. Range: 3~10. 3 YES
service.beta.kubernetes.io/volcengine-loadbalancer-unhealthy-threshold Integer NO The number of consecutive health check failures before the backend server's health check status is changed from Success to Failure. Range: 3-10. 3 YES
service.beta.kubernetes.io/volcengine-loadbalancer-acl-status String NO Whether to enable access control for listener of CLB. Value:
off: disable.
on: enable.
off YES
service.beta.kubernetes.io/volcengine-loadbalancer-acl-type String NO Access control type. Value:
black: Deny requests from the IP addresses in the selected access control lists.
white: Accept requests from the IP addresses in the selected access control lists.
- YES
service.beta.kubernetes.io/volcengine-loadbalancer-acl-id String NO IDs of the access control lists. See ACL for more details. A maximum of 5 IDs can be passed in. Multiple IDs can be separated by ,. - YES
service.beta.kubernetes.io/volcengine-loadbalancer-proxy-protocol String NO Whether to enable Proxy Protocol feature. Value:
standard: enable.
off: disable.
off YES

Example

Use existing CLB

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-id: "clb-mim02n8g5kw05smt1b******"
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer

Create new CLB

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-subnet-id: "subnet-mizw4xqzpssg5smt1b******"
    service.beta.kubernetes.io/volcengine-loadbalancer-address-type: "PUBLIC"
    service.beta.kubernetes.io/volcengine-loadbalancer-isp-type: "BGP"
    service.beta.kubernetes.io/volcengine-loadbalancer-billing-type: "2"
    service.beta.kubernetes.io/volcengine-loadbalancer-eip-billing-type: "3"
    service.beta.kubernetes.io/volcengine-loadbalancer-bandwidth: "25" 
    service.beta.kubernetes.io/volcengine-loadbalancer-spec: "small_1"
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer

Configure scheduling policy

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-id: "clb-mim02n8g5kw05smt1b******"
    service.beta.kubernetes.io/volcengine-loadbalancer-scheduler: "wrr"
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer

Configure health check

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-id: "clb-mim02n8g5kw05smt1b******"
    service.beta.kubernetes.io/volcengine-loadbalancer-health-check-flag: "on" 
    service.beta.kubernetes.io/volcengine-loadbalancer-health-check-connect-timeout: "2" 
    service.beta.kubernetes.io/volcengine-loadbalancer-health-check-interval: "2" 
    service.beta.kubernetes.io/volcengine-loadbalancer-healthy-threshold: "3" 
    service.beta.kubernetes.io/volcengine-loadbalancer-unhealthy-threshold: "3" 
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer

Configure access control lists

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-id: "clb-mim02n8g5kw05smt1b******"
    service.beta.kubernetes.io/volcengine-loadbalancer-acl-status: "on"
    service.beta.kubernetes.io/volcengine-loadbalancer-acl-type: "white"
    service.beta.kubernetes.io/volcengine-loadbalancer-acl-id: "acl-3cj44nv0jhhxc6c6rrtet****,acl-2febxt4pu0zy85oxruw0t****"
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer

Configure proxy protocol

Proxy-Protocol is a beta feature of CLB. Submit work order to have a try.

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/volcengine-loadbalancer-id: "clb-mim02n8g5kw05smt1b******"
    service.beta.kubernetes.io/volcengine-loadbalancer-proxy-protocol: "standard"
  name: clb-service
  namespace: default
spec:
  loadBalancerClass: volcengine.com/clb
  externalTrafficPolicy: Cluster
  selector:
    app: nginx
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  type: LoadBalancer