일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- awx
- OpenStack
- Octavia
- Linux
- libvirt
- repository
- kolla
- golang
- cephadm
- nfs-provisioner
- Kubernetes
- k8s
- pacman
- kolla-ansible
- grafana-loki
- Kubeflow
- yum
- archlinux
- Arch
- ceph
- cloud-init
- i3
- Docker
- KVM
- Ansible
- terraform
- HTML
- ceph-ansible
- ubuntu
- port open
Archives
- Today
- Total
YJWANG
Kubernetes PV (NFS) 본문
k8s PersistentVolume NFS
https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs
prerequisite
사전작업 NFS구성이므로 자세히 설명하진 않겠습니다.CentOS8.X
기준으로 아래와 같이 NFS 서버를 구성하고 테스트합니다.
당연히 export할 directory는 사전히 생성돼야합니다.
227 yum -y install nfs-utils.x86_64
228 systemctl status nfs-server
229 systemctl status firewalld
230 getenforce
[root@wyj01_deploy_0 data]# head -v -z /etc/exports
==> /etc/exports <==
/data *(rw,sync,no_root_squash)
241 exportfs -v
242 mount 10.11.90.90:/data /mnt
243 df -h
pv manifest
[root@master01 pvtest]# cat pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: 10.11.90.90
path: "/data"
pv deploy
[root@master01 pvtest]# kubectl create -f pv.yaml
persistentvolume/nfs created
[root@master01 pvtest]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs 10Gi RWX Retain Available 3s
pvc manifest
[root@master01 pvtest]# cat pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkins
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 1Gi
pvc deploy
[root@master01 pvtest]# kubectl create -f pvc.yaml
persistentvolumeclaim/jenkins created
[root@master01 pvtest]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
jenkins Bound nfs 10Gi RWX 3s
[root@master01 pvtest]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs 10Gi RWX Retain Bound default/jenkins 2m17s
nfs pv Pod 통해 실습
==> ./pv.yaml <==
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-testdir
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: 10.11.90.90
path: "/data/testdir"
==> ./pv_httpd.yaml <==
apiVersion: v1
kind: Pod
metadata:
name: pv-test-pod
spec:
volumes:
- name: nfs-testdir
persistentVolumeClaim:
claimName: nfs-testdir-claim
containers:
- name: pv-test-con
image: httpd
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/local/apache2/htdocs"
name: nfs-testdir
==> ./pvc.yaml <==
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-testdir-claim
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 5Gi
[root@master01 pvtest]# kubectl exec -it pv-test-pod -- /bin/bash
root@pv-test-pod:/usr/local/apache2# df -h
Filesystem Size Used Avail Use% Mounted on
10.11.90.90:/data/testdir 24G 2.8G 21G 12% /usr/local/apache2/htdocs
반응형