mirror of https://github.com/easzlab/kubeasz.git
add local storage example
parent
73bedd7c37
commit
3a03ae67db
|
@ -7,6 +7,7 @@ bin/*
|
|||
# k8s storage manifests
|
||||
manifests/storage/*
|
||||
!manifests/storage/test.yaml
|
||||
!manifests/storage/local-storage/
|
||||
|
||||
# role based variable settings, exclude roles/os-harden/vars/
|
||||
#/roles/*/vars/*
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: local-test
|
||||
spec:
|
||||
serviceName: ""
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: local-test
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: local-test
|
||||
spec:
|
||||
containers:
|
||||
- name: test-container
|
||||
image: busybox
|
||||
command:
|
||||
- "/bin/sh"
|
||||
args:
|
||||
- "-c"
|
||||
- "sleep 100000"
|
||||
volumeMounts:
|
||||
- name: local-vol
|
||||
mountPath: /usr/test-pod
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: local-vol
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
storageClassName: "local-storage"
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: local-pv1
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Delete
|
||||
storageClassName: local-storage
|
||||
local:
|
||||
path: /mnt/disks/vol1
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- 192.168.1.2
|
||||
- 192.168.1.3
|
|
@ -0,0 +1,22 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: local-pv2
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Delete
|
||||
storageClassName: local-storage
|
||||
local:
|
||||
path: /mnt/disks/vol2
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- 192.168.1.4
|
|
@ -0,0 +1,6 @@
|
|||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: local-storage
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
Loading…
Reference in New Issue