Commit 7673cec2 authored by Nguyễn Văn Vũ's avatar Nguyễn Văn Vũ

Week7 - Setup NFS server and deploy minio app used pv and pvc for stored data

parent 10b3ef04
# My subnet is 10.0.2.15/24
# Installing NFS client
sudo apt install nfs-common
#!bin/bash
# This file used for set up nfs server on Ubuntu 22.04
# Subnet “10.0.2.15/24” (Client) to access the NFS server
# Update system packages
sudo apt update
# Install NFS server
sudo apt install nfs-kernel-server
# Make shared NFS directory
sudo mkdir -p /mnt/nfs_share
# Set directory permissions
sudo chown -R nobody:nogroup /mnt/nfs_share/
# Set file permissions
sudo chmod 777 /mnt/nfs_share/
# Grant NFS access
sudo echo "/mnt/nfs_share 10.0.2.15/24(rw,sync,no_subtree_check)" > /etc/exports
# Exporting NFS directory
sudo exportfs -a
# Restart NFS server
sudo systemctl restart nfs-kernel-server
# Grant Firewall access
sudo ufw allow from 10.0.2.15/24 to any port nfs
# Enable Firewall
sudo ufw enable
# Check Firewall status
sudo ufw status
\ No newline at end of file
---
apiVersion: v1
kind: Namespace
metadata:
name: minio-application
labels:
name: minio-application
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: minio
name: minio
namespace: minio-application
spec:
containers:
- name: minio
image: quay.io/minio/minio:latest
resources:
limits:
memory: "2048Mi"
cpu: "2000m"
command:
- /bin/bash
- -c
args:
- minio server /data --console-address :9090
volumeMounts:
- mountPath: /data
name: localvolume
volumes:
- name: localvolume
persistentVolumeClaim:
claimName: minio-pvc
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: minio-pv
spec:
capacity:
storage: 1024Mi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
storageClassName: ""
persistentVolumeReclaimPolicy: Recycle
nfs:
path: /var/nfs/k8s
server: 192.168.68.8
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pvc
namespace: minio-application
spec:
resources:
requests:
storage: 1000Mi
volumeMode: Filesystem
storageClassName: ""
volumeName: minio-pv # Specific PV to PVC connect
accessModes:
- ReadWriteOnce
apiVersion: v1
kind: Service
metadata:
name: minio-svc
namespace: minio-application
spec:
type: LoadBalancer
selector:
app: minio
ports:
- port: 9090
nodePort: 30011
targetPort: 9090
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment