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" to automatically create <ServiceName>-auto-service-config. You can also directly specify a TkeServiceConfig that you created by using service.cloud.tencent.com/tke-service-config:<config-name>. The two annotations cannot be used at the same time, and the manually specified <config-name> cannot end with -auto-service-config or -auto-ingress-config.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|TCP_SSL|QUIC.port: 80 # Required. Value range: 1-65535.listenerName: custom-name # Custom listener name. Optional. (Ensure the component version is >= 2.11.0)snatEnable: false # SNAT switch. Optional. The CLB allowlist is required. When SNAT is enabled, the source IP seen by the backend Pod is the VIP (virtual IP) of the CLB, and the client source IP is not passed through. (Ensure the component version is >= 2.11.0)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: "HTTP" # Health check type. Optional. Enumerated value: TCP|HTTP|CUSTOM (only applicable to TCP/UDP listeners, where UDP listeners only support CUSTOM; if the custom health check feature is used, this field is required).checkPort: 80 # Health check port. Optional. It is the port of the backend service by default. It is recommended to leave it blank unless you wish to specify a port. (Only suitable for TCP/UDP listeners).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: 5 # Response timeout for health check. The response timeout must be less than the 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: "example.com" # Health check domain, optional, cannot be empty. 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 mode configuration. WRR and LEAST_CONN indicate weighted round robin and least connections respectively. Optional. Enum values: WRR, LEAST_CONN, and others.proxyProtocol:enable: false # Enable ProxyProtocol. Off by default.idleConnectTimeout: 900 # Idle connection timeout. Optional. Value range: 10-1980. Only applicable to TCP/UDP listeners. (Ensure the component version is >= 2.12.0)
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:# Deployment resource configuration file$ kubectl apply -f jetty-deployment.yaml$ kubectl apply -f jetty-service.yaml$ kubectl apply -f jetty-service-config.yaml
# Check the running status of Pods$ 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# Check the running status of Services$ 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
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários