Rate This Document
Findability
Accuracy
Completeness
Readability

KAE Device Passthrough

This section uses the HPRE device as an example to describe how to pass through a KAE device to a container.

To pass through other devices, change the resource name to that of the corresponding device as described in Table 1.

Table 1 Mapping between KAE devices and KAE device resource names

KAE Device

Device Resource Name

HPRE

kae.kunpeng.com/hisi_hpre

SEC

kae.kunpeng.com/hisi_sec2

ZIP

kae.kunpeng.com/hisi_zip

KAE devices require KAE libraries for normal running. Generally, KAE libraries are not installed in containers. In this example, KAE libraries on the host are mapped to the container. In practice, you can install KAE libraries in the container or map the KAE libraries on the host to the container as required.

  1. Make the declaration in the YAML file of the Pod.
    The device to be used is declared by adding kae.kunpeng.com/hisi_hpre: "1" to requests and limits in resources.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    apiVersion: v1
    kind: Pod
    metadata:
      name: kae-test
    spec:
      containers:
      - name: kae-test
        image: kae-test:latest
        command: ["/bin/sh", "-c", "while true; do echo hello; sleep 300000; done"]
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            kae.kunpeng.com/hisi_hpre: "1"
          limits:
            kae.kunpeng.com/hisi_hpre: "1"
        volumeMounts:
          - name: local-lib
            mountPath: /usr/local
      volumes:
        - name: local-lib
          hostPath:
            path: /usr/local/  
    
  2. Deploy the Pod.
    1
    kubectl apply -f kae-pod/kae-test-pod.yaml
    
  3. After the deployment is complete, check the Pod status.
    1
    kubectl get pod
    

    The command output is as follows. If the Pod status is Running, the installation is successful.

    1
    2
    NAME       READY   STATUS    RESTARTS   AGE
    kae-test   1/1     Running   0          3h20m
    
  4. Access the Pod and check whether the KAE device has been mounted.
    1
    2
    kubectl exec -it kae-test bash
    ls /dev
    

    kae-test indicates the Pod name. Change it to the Pod name you have defined.

  5. If the hisi_hpre-x device exists in the /dev directory, the KAE device has been mounted successfully.