Rate This Document
Findability
Accuracy
Completeness
Readability

Starting a Kubernetes Video Stream Cloud Phone Instance

Perform the following operations on worker nodes.

  1. Modify the k8s-video.yaml file.
    1
    2
    cd /home/k8s/k8s/script
    vi k8s-video.yaml
    

    Change the following fields to the actual values:

    • spec.containers.image: video stream image. Enter the name of the video stream image imported to the worker node.
    • spec.containers.resources.limits.cpu and spec.containers.resources.requests.cpu: number of cores to be bound to containers. The two fields need to be modified together.
    • spec.containers.resources.limits.memory and spec.containers.resources.requests.memory: container memory. The two fields need to be modified together.
  2. Start a Kubernetes video stream cloud phone.
    1
    ./k8s-video.sh start ${index1} ${index2}
    

    ${index1} and ${index2} indicate Pod IDs, and ${index2} can be left blank. Example:

    • Create a Pod video2.
      ./k8s-video.sh start 2
    • Create five Pods from video1 to video5.
      ./k8s-video.sh start 1 5
  3. Check whether the Pods are successfully started.
    1
    kubectl get pods -o wide
    

    It is expected that the STATUS column of Pods whose names start with video is Running.

    When multiple cloud phones are started, new cloud phones may fail to be launched because the Pod limit (110 by default) has been reached. You can edit the /etc/sysconfig/kubelet file on the worker node by adding --max-pods=300 to KUBELET_EXTRA_ARGS. Then, run the systemctl restart kubelet command to restart kubelet. You do not need to clear the existing containers before the restart.

    You can run the following command to verify that the value of Capacity.pods is 300. $NODENAME indicates the name of the worker node.

    1
    kubectl describe node $NODENAME
    
  4. Connect to the video stream cloud phone and container. In the NODE column, you can view the node corresponding to the Pod of the video stream cloud phone.
    1
    kubectl get pods -o wide
    

    Access the video stream cloud phone based on Accessing a Video Stream Cloud Phone. The client connection port is 8000 + ${index}, where ${index} indicates the Pod ID.

    • On the master node and worker node, you can run the following command to access the container. The following uses video1 as an example:
      1
      kubectl exec -it video1 -- sh
      
    • On the worker node, you can run the crictl ps command to view the cloud phone instance. The corresponding Pod is displayed in the NAME field. Run the following command to access the container. Replace ${CONTAINER} with the value in the first column in the crictl ps command output.
      1
      crictl exec -it ${CONTAINER} sh