Found 0 result in total
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-04-14 15:43:55
You can use EBS volumes in KSK.
Kingsoft Cloud provides the following methods for you to mount EBS volumes to Kubernetes:
You can use EBS static volumes by using one of the following two methods:
An EBS volume does not support shared storage and can only be mounted to a single KCI pod. The number of replicas must be set to 1.
Before you use a static volume, you must create an EBS volume in the EBS console and obtain the volume ID.
The volume name and PV name must be the same as the volume ID.
An EBS volume can only be mounted to a KCI pod in the same availability zone.
In the following nginx-disk-deploy.yaml file, the EBS volume specified in the YAML file is mounted to the /data path of the nginx-flexvolume-disk container in the pod.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-disk-deploy
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-flexvolume-disk
image: nginx
volumeMounts:
- name: "db1bd24b-609b-4f3d-9b16-96249a809023"
mountPath: "/data"
volumes:
- name: "db1bd24b-609b-4f3d-9b16-96249a809023"
flexVolume:
driver: "ksc/ebs"
fsType: "ext4"
options:
volumeId: "db1bd24b-609b-4f3d-9b16-96249a809023"
Define a PV.
apiVersion: v1
kind: PersistentVolume
metadata:
name: "db1bd24b-609b-4f3d-9b16-96249a809023"
spec:
capacity:
storage: 20Gi
storageClassName: disk
accessModes:
- ReadWriteOnce
flexVolume:
driver: "ksc/ebs"
fsType: "ext4"
options:
volumeId: "db1bd24b-609b-4f3d-9b16-96249a809023"
Define a PVC.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-disk
spec:
accessModes:
- ReadWriteOnce
storageClassName: disk
resources:
requests:
storage: 20Gi
Create a Deployment.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-disk-deploy
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx--disk
image: nginx
volumeMounts:
- name: pvc-disk
mountPath: "/data"
volumes:
- name: pvc-disk
persistentVolumeClaim:
claimName: pvc-disk
You need to manually create a StorageClass for a dynamic volume and specify the StorageClass name in a PVC.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ssd30
provisioner: ksc/ebs
parameters:
type: SSD3.0
zone: cn-beijing-6b # Optional #
chargetype: Daily
Parameter description:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: pvc-disk
mountPath: "/data"
volumes:
- name: pvc-disk
persistentVolumeClaim:
claimName: nginx-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: ssd30
resources:
requests:
storage: 20Gi
Pure Mode