Service Extension Protocol

Last updated: 2021-05-11 15:20:44

    Protocols Supported by Service by Default

    Service is a mechanism and abstraction through which Kubernetes opens apps to traffic outside clusters. You can access apps in a cluster via Service.

    By default, Service supports the following protocols:

    • In Cluster IP and NodePort modes, the TCP and UDP protocols are supported and can be used together.
    • In LoadBalancer mode, the TCP and UDP protocols are supported, but cannot be used together.

    TKE Extension of Service Forwarding Protocols

    Based on the rules of the protocols supported by native Service, there are some scenarios where Service must support the mixed use of TCP and UDP as well as TCP SSL, HTTP, and HTTPS protocols. TKE extends support for more protocols in LoadBalancer mode.

    Prerequisite Notes

    • Extension protocols are only effective for Service in LoadBalancer mode.
    • Extension protocols describe the relationships between protocols and ports through annotations.
    • The relationships between protocols and annotations are as follows:
      • When the extension protocol annotation does not cover the port described in Service Spec, Service Spec is configured according to the user description.
      • When the port described in the extension protocol annotation does not exist in Service Spec, the configuration is ignored.
      • When the port described in the extension protocol annotation exists in Service Spec, the protocol configuration that users state in Service Spec will be overwritten.

    Extension protocol usage instructions

    apiVersion: v1
    kind: Service
        name: test
    • Annotation name::
    • Extension protocol annotation samples:

      TCP SSL sample


      HTTP sample


      HTTPS sample


      TCP/UDP mixed-use sample


      Mixed-use sample