service.cloud.tencent.com/tke-service-config:<config-name>, you can specify the target configuration and apply it to the Service.spec.loadBalancer.l4Listeners.protocol: Layer-4 protocolspec.loadBalancer.l4Listeners.port: Listening portservice.cloud.tencent.com/tke-service-config-auto: "true", <ServiceName>-auto-service-config will be automatically created. Alternatively, you can specify your own created TkeServiceConfig through service.cloud.tencent.com/tke-service-config:<config-name>. These two annotations cannot be used at the same time, and the manually specified <config-name> cannot be suffixed with -auto-service-config and -auto-ingress-config.TkeServiceConfig has the following sync behaviors:TkeServiceConfig has the following sync behaviors:apiVersion: cloud.tencent.com/v1alpha1kind: TkeServiceConfigmetadata:name: sample # Configuration namenamespace: default # Configuration namespacespec:loadBalancer:l4Listeners: # Layer-4 rule configuration, applicable to Service listener configuration.- protocol: TCP # Layer-4 rule for protocol ports anchoring the Service. Required. Enumerated value: TCP|UDP.port: 80 # Required. Value range: 1-65535.deregisterTargetRst: true # Optional. Boolean. Bidirectional RST switch. Recommended for non-direct connection type Services. Non-direct connection Services will be relayed through NodePort. Not enabling bidirectional RST may cause business interruption after cluster nodes are taken offline.session: # Configuration related to session persistence. Optional.enable: true # Indicates whether to enable session persistence. Required. Boolean.sessionExpireTime: 100 # Session persistence duration. Optional. Default value: 30. Value range: 30-3600. Unit: second.healthCheck: # Configuration related to health check. Optional.enable: true # Indicates whether to enable health check. Required. Boolean.checkType: "TCP" # Health check type. Optional. Enumerated value: TCP|HTTP|CUSTOM (only applicable to TCP/UDP listeners, where UDP listeners only support CUSTOM; if using custom health check functionality, this field is required).intervalTime: 10 # Health check probe interval. Optional. Default value: 5. Value range: 5-300. Unit: second.healthNum: 2 # Healthy threshold, indicating the number of consecutive healthy health check results that it takes to indicate normal forwarding. Optional. Default value: 3. Value range: 2-10. Unit: times.unHealthNum: 3 # Unhealthy threshold, indicating the number of consecutive unhealthy health check results that it takes to indicate a forwarding exception. Optional. Default value: 3. Value range: 2-10. Unit: times.timeout: 10 # Health check response timeout threshold. This should be less than the health check interval. Optional. Default value: 2. Value range: 2-60. Unit: second.httpCode: 31 # Health check status code. Optional. Default value: 31. Value range: 1-31. Only applicable to HTTP/HTTPS forwarding rules and HTTP health check methods for TCP listeners. 1 indicates that a return value of 1xx after probing represents health, 2 indicates that 2xx represents health, 4 indicates that 3xx represents health, 8 indicates that 4xx represents health, and 16 indicates that 5xx represents health. If multiple return codes are desired to represent health, add the corresponding values.httpCheckPath: "/" # Health check path. Optional. Only applicable to HTTP/HTTPS forwarding rules and HTTP health check methods for TCP listeners.httpCheckDomain: "" # Health check domain. Optional. Default is the domain of the layer-7 rule (only applicable to HTTP/HTTPS forwarding rules and HTTP health check methods for TCP listeners).httpCheckMethod: "HEAD" # Health check method (only applicable to HTTP/HTTPS forwarding rules and HTTP health check methods for TCP listeners). Default value: HEAD. Value range: HEAD or GET.httpVersion: "HTTP/1.1" # Custom probe related parameters. When the health check protocol CheckType is HTTP, this field is required and represents the HTTP version of the backend service: HTTP/1.0, HTTP/1.1; (only applicable to TCP listeners).sourceIpType: 0 # Health check probe source. 0 (VIP as source IP) 1 (100.64 as source IP). For domain-based CLB, the default value is 1 and can only be 1. For non-domain-based CLB, the default value may vary. Check the CLB console configuration page to see if VIP probe mode is available. If available, the default value is 0; otherwise, it is 1. For more details, see https://www.tencentcloud.com/document/product/214/53639scheduler: WRR # Request forwarding method. WRR, LEAST_CONN, and IP_HASH indicate polling by weight, least connections, and hashing by IP address, respectively. Optional. Enumerated value: WRR | LEAST_CONN.
apiVersion: apps/v1kind: Deploymentmetadata:labels:app: jettyname: jetty-deploymentnamespace: defaultspec:progressDeadlineSeconds: 600replicas: 3revisionHistoryLimit: 10selector:matchLabels:app: jettystrategy:rollingUpdate:maxSurge: 25%maxUnavailable: 25%type: RollingUpdatetemplate:metadata:creationTimestamp: nulllabels:app: jettyspec:containers:- image: jetty:9.4.27-jre11imagePullPolicy: IfNotPresentname: jettyports:- containerPort: 80protocol: TCP- containerPort: 443protocol: TCPresources: {}terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30
apiVersion: v1kind: Servicemetadata:annotations:service.cloud.tencent.com/tke-service-config: jetty-service-config# Specify the existing tke-service-config# service.cloud.tencent.com/tke-service-config-auto: "true"# Automatically create a `tke-service-config`name: jetty-servicenamespace: defaultspec:ports:- name: tcp-80-80port: 80protocol: TCPtargetPort: 80- name: tcp-443-443port: 443protocol: TCPtargetPort: 443selector:app: jettytype: LoadBalancer
jetty-service-config CLB configuration is used.apiVersion: cloud.tencent.com/v1alpha1kind: TkeServiceConfigmetadata:name: jetty-service-confignamespace: defaultspec:loadBalancer:l4Listeners:- protocol: TCPport: 80deregisterTargetRst: truehealthCheck:enable: false- protocol: TCPport: 443session:enable: truesessionExpireTime: 3600healthCheck:enable: trueintervalTime: 10healthNum: 2unHealthNum: 2timeout: 5scheduler: WRR
jetty-service-config, and in the layer-4 listener configuration, two configuration segments are declared:$ kubectl apply -f jetty-deployment.yaml$ kubectl apply -f jetty-service.yaml$ kubectl apply -f jetty-service-config.yaml$ kubectl get podsNAME READY STATUS RESTARTS AGEjetty-deployment-8694c44b4c-cxscn 1/1 Running 0 8m8sjetty-deployment-8694c44b4c-mk285 1/1 Running 0 8m8sjetty-deployment-8694c44b4c-rjrtm 1/1 Running 0 8m8s$ kubectl get service jetty-serviceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEjetty LoadBalancer 10.127.255.209 150.158.220.237 80:31338/TCP,443:32373/TCP 2m47s# Get the `TkeServiceConfig` configuration list$ kubectl get tkeserviceconfigs.cloud.tencent.comNAME AGEjetty-service-config 52s# Update and modify the `TkeServiceConfig` configuration$ kubectl edit tkeserviceconfigs.cloud.tencent.com jetty-service-configtkeserviceconfig.cloud.tencent.com/jetty-service-config edited
Feedback