runtime-rs: add examples about Kata pod with directvol by CSI.

Fixes: #8602

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn
2023-12-13 20:19:39 +08:00
parent c6d2a32146
commit ba5437382a
6 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#!/bin/bash
#
# Copyright (c) 2023 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
set -o pipefail
BASE_DIR=$(dirname "$0")/pod-with-directvol
kubectl apply -f ${BASE_DIR}/csi-storageclass.yaml
kubectl apply -f ${BASE_DIR}/csi-pvc.yaml
kubectl apply -f ${BASE_DIR}/csi-app.yaml

View File

@@ -0,0 +1,15 @@
#!/bin/bash
#
# Copyright (c) 2023 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
set -o pipefail
BASE_DIR=$(dirname "$0")/pod-with-directvol
kubectl delete -f ${BASE_DIR}/csi-app.yaml
kubectl delete -f ${BASE_DIR}/csi-pvc.yaml
kubectl delete -f ${BASE_DIR}/csi-storageclass.yaml

View File

@@ -0,0 +1,18 @@
kind: Pod
apiVersion: v1
metadata:
name: kata-driectvol-01
spec:
runtimeClassName: kata
containers:
- name: first-container
image: ubuntu:22.04
volumeMounts:
- mountPath: "/data"
name: kata-driectvol0-volume
command: [ "sleep", "1000000" ]
volumes:
- name: kata-driectvol0-volume
persistentVolumeClaim:
claimName: csi-directvolume-pvc # defined in csi-pvc.yaml

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-directvolume-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: csi-kata-directvolume-sc # defined in csi-storageclass.yaml

View File

@@ -0,0 +1,12 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-kata-directvolume-sc
parameters:
katacontainers.direct.volume/volumetype: directvol
katacontainers.direct.volume/fstype: ext4
provisioner: directvolume.csi.katacontainers.io
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: false

View File

@@ -0,0 +1,5 @@
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: kata
handler: kata