쿠버네티스 모든 노드에 nfs client 설치가 필요하다.
이거 때문에 주말을 날렸다..
요약
# install nfs-server
sudo apt update && sudo apt install nfs-kernel-server
sudo mkdir -p /nfs
sudo chmod 777 /nfs # 검토 필요
sudo chown -R nobody:nogroup /nfs
sudo echo '/nfs 10.0.0.0/24(rw,sync,no_subtree_check)' >> /etc/exports
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
# client nfs test
sudo apt update && sudo apt install nfs-common
showmount -e 10.0.0.110
## /nfs 10.0.0.110
sudo mkdir /tmp_nfs
sudo mount 10.0.0.110:/nfs /tmp_nfs
# client TL;DR - Helm
helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
--set nfs.server=10.0.0.110 \
--set nfs.path=/nfs \
--set storageClass.defaultClass=true
설치
with helm : https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner#with-helm
with manually : https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner#manually
1. helm : repo 추가 -> 설치
helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
--set nfs.server=10.0.0.110 \
--set nfs.path=/nfs \
--set storageClass.defaultClass=true
2. manually : create rbac.yaml -> apply deployment.yaml
git clone https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner.git
cd nfs-subdir-external-provisioner/deploy
kubectl create -f rbac.yaml
kubectl create -f deployment.yaml # 파일 수정
vi deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-client-provisioner
labels:
app: nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: nfs-client-provisioner
template:
metadata:
labels:
app: nfs-client-provisioner
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: k8s-sigs.io/nfs-subdir-external-provisioner
- name: NFS_SERVER
value: 10.0.0.110
- name: NFS_PATH
value: /nfs
volumes:
- name: nfs-client-root
nfs:
server: 10.0.0.110
path: /nfs
테스트
1. pvc, pod 생성
2. 생성 확인
'Infra > IaC' 카테고리의 다른 글
[k8s] Nginx ingress : Bare metal clusters 설치 (1) | 2023.11.24 |
---|---|
[k8s] kubeflow install : 진행중 (0) | 2023.11.19 |
[k8s] Nginx Ingress : Rewrite Target (0) | 2023.11.16 |
[k8s] nginx forward proxy (정방향 프록시) (0) | 2023.11.09 |
[IaC] k9s 설치 (0) | 2023.11.08 |