github.com/oam-dev/kubevela@v1.9.11/references/docgen/def-doc/trait/container-ports.eg.md (about)

     1  It's used to define Pod networks directly. hostPort routes the container's port directly to the port on the scheduled node, so that you can access the Pod through the host's IP plus hostPort.
     2  Don't specify a hostPort for a Pod unless it is absolutely necessary(run `DaemonSet` service). When you bind a Pod to a hostPort, it limits the number of places the Pod can be scheduled, because each <hostIP, hostPort, protocol> combination must be unique. If you don't specify the hostIP and protocol explicitly, Kubernetes will use 0.0.0.0 as the default hostIP and TCP as the default protocol.
     3  If you explicitly need to expose a Pod's port on the node, consider using `expose` or `gateway` trait, or exposeType and ports parameter of `webservice` component before resorting to `container-ports` trait.
     4  ```yaml
     5  apiVersion: core.oam.dev/v1beta1
     6  kind: Application
     7  metadata:
     8    name: busybox
     9  spec:
    10    components:
    11      - name: busybox
    12        type: webservice
    13        properties:
    14          cpu: "0.5"
    15          exposeType: ClusterIP
    16          image: busybox
    17          memory: 1024Mi
    18          ports:
    19            - expose: false
    20              port: 80
    21              protocol: TCP
    22            - expose: false
    23              port: 801
    24              protocol: TCP
    25        traits:
    26          - type: container-ports
    27            properties:
    28              # you can use container-ports to control multiple containers by filling `containers`
    29              # NOTE: in containers, you must set the container name for each container
    30              containers:
    31                - containerName: busybox
    32                  ports:
    33                    - containerPort: 80
    34                      protocol: TCP
    35                      hostPort: 8080
    36  ```