Operations on a Worker Node
Add a worker node to the cluster.
Obtain the DemoVideoEngine.tar.gz software package based on Video Stream Engine, and upload the software package to the /home/k8s directory on the server.
- Configure container storage isolation and storage size. Perform this step again after the server is restarted.
1 2 3 4 5
cd /home/k8s tar -xvf DemoVideoEngine.tar.gz k8s/ cd /home/k8s/k8s/DevicesPlugin chmod +x storage_manager.sh ./storage_manager.sh $ACTION $STORAGE_START_INDEX $STORAGE_END_INDEX $STORAGE_SIZE_GB $IMG_BASE
Table 1 describes the command parameters.
Table 1 Parameters for configuring container storage isolation and storage size Parameter
Description
ACTION
Specifies the action. The value can be create or delete.
STORAGE_START_INDEX
Specifies the start index of the data volume to be deleted or created.
STORAGE_END_INDEX
Specifies the end index of the data volume to be deleted or created. The end index must be greater than or equal to the start index.
STORAGE_SIZE_GB
Specifies the storage size, in GB. This parameter is unavailable when the action is delete.
IMG_BASE
Specifies the image file of the base data volume. If there is no base data volume, this parameter can be left blank. For details about how to create an image file of the base data volume, see Creating a Base Data Volume. This parameter is unavailable when the action is delete. Transfer either STORAGE_SIZE_GB or IMG_BASE.
For example:
- Create 100 isolated data volumes from video1 to video100 whose storage size is 32 GB each.
1./storage_manager.sh create 1 100 32
- Add 20 isolated data volumes from video101 to video120 whose storage size is 32 GB each.
1./storage_manager.sh create 101 120 32
- Delete data volumes video1 to video100.
1./storage_manager.sh delete 1 100
- Delete the remaining 20 data volumes (video101 to video120).
1./storage_manager.sh delete 101 120
- Use videobase.img to create data volumes video1 to video100.
1./storage_manager.sh create 1 100 /home/mount/img/videobase.img
If you have run commands in this step and want to change the storage size of a data volume (video1 for example), you need to delete the data volume and then create it again with the required size.
- Create 100 isolated data volumes from video1 to video100 whose storage size is 32 GB each.
- Run the token commands to join the cluster. (The commands are saved when the master node is initialized successfully. See the red box in Figure 1.)
For example:
1 2
kubeadm join xx.xx.xx.xx:xxxx --token 7h0hpd.1av4cdcb4fb0on5x \ --discovery-token-ca-cert-hash sha256:357c6d1dbefe6f7adf3c80987a90d3765965b1c43e1757b655ea8586c8ade10a
- After a worker node is restarted and added to the cluster, ensure that the worker node can run the video stream cloud phone.
- xx.xx.xx.xx indicates the IP address, and xxxx indicates the mapped port.
- If the token commands for joining the cluster are invalid, run the following command on the master node to generate a new token:
1kubeadm token create --print-join-command
- Check the cluster status.
- Check the status on the master node.
1kubectl get nodes -A -o wide
It is expected that the STATUS column of this worker node is Ready and the CONTAINER-RUNTIME column is containerd://x.x.x.
- Check the Pod status on the master node.
1kubectl get pod -A -o wide
It is expected that the STATUS column of all Pods on the worker node is Running.
- Check the container status on the worker node.
1crictl psIt is expected that the STATE column of all containers is Running.
- Check the status on the master node.
- (Optional) Configure NUMA affinity.
- When configuring the compilation environment and compiling plugins, ensure that the Golang version is 1.23 or later. Place the go directory of Golang 1.23 in /usr/lib, and place go/bin/go and go/bin/gofmt in /usr/bin.
1 2 3
systemctl stop kubeletexport GOROOT=/usr/lib/go go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io,direct
- Obtain the Kubernetes NUMA affinity plugin package topo-affinity-plugin-master.zip from Video Stream Engine and upload it to the /home/k8s directory on the server.
- Decompress topo-affinity-plugin-master.zip, go to the package directory, and compile the plugin.
1 2 3 4
unzip topo-affinity-plugin-master.zip cd topo-affinity-plugin-master go mod tidy make build
After the build is complete, ensure that the kunpeng-tap binary file is generated in the bin directory.
- Install the containerd runtime.
make install-service-containerd
If you need to modify the startup parameters, modify the parameters under ExecStart= in the hack/kunpeng-tap.service.containerd file in the source code directory. Table 2 describes the parameters.
[Unit] Description=Kunpeng Topology-Affinity Plugin Service After=network.target [Service] ExecStart=/usr/local/bin/kunpeng-tap --runtime-proxy-endpoint="/var/run/kunpeng/tap-runtime-proxy.sock" \ --container-runtime-service-endpoint="/var/run/containerd/containerd.sock" --container-runtime-mode="Containerd" \ --resource-policy="topology-aware" --v=2 Restart=always RestartSec=5 [Install] WantedBy=multi-user.targetTable 2 Startup parameters Parameter Name
Parameter Description
Default Value
Remarks
container-runtime-mode
Container runtime connected to the plugin, which can be Docker or containerd.
containerd
Determine the container runtime according to that used in the Kubernetes cluster.
resource-policy
Container resource optimization policy. Currently, numa-aware and topology-aware are supported.
- numa-aware supports CPU NUMA affinity for containers of the Burstable type.
- topology-aware provides CPU affinity at the socket, die, and NUMA levels, and supports memory and GPU optimization configurations.
topology-aware
Select a policy as required.
v
Log level. The value ranges from 2 to 5.
2
The higher the level, the more detailed the logs.
- Start the TAP service.
make start-service
After the startup is successful, the value of Status in the command output is active.
- Modify and restart kubelet.
- Before the restart, ensure that no container is deployed on the node.
- Modify the kubelet configuration file /var/lib/kubelet/kubeadm-flags.env.The initial configuration is as follows:
1KUBELET_KUBEADM_ARGS="... --container-runtime=remote --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock ..."
Modify the file as follows:1KUBELET_KUBEADM_ARGS="... --container-runtime=remote --container-runtime-endpoint=unix:///var/run/kunpeng/tap-runtime-proxy.sock ..."
- Restart kubelet and check whether the restart is successful.
1 2 3
systemctl daemon-reload systemctl restart kubelet systemctl status kubelet
To uninstall the TAP plugin, perform the following steps:
- Restore the /var/lib/kubelet/kubeadm-flags.env file to its initial content, and then restart kubelet.
systemctl daemon-reload systemctl restart kubelet systemctl status kubelet
- Enter to the topology-affinity-plugin source code directory and run the following command to uninstall the plugin:
cd /home/k8s/topo-affinity-plugin-master make uninstall-service
- Restore the /var/lib/kubelet/kubeadm-flags.env file to its initial content, and then restart kubelet.
- When configuring the compilation environment and compiling plugins, ensure that the Golang version is 1.23 or later. Place the go directory of Golang 1.23 in /usr/lib, and place go/bin/go and go/bin/gofmt in /usr/bin.