一、远程部署nfs服务

服务端

ubuntu: apt-get install nfs-kernel-server
centos: yum -y install rpcbind nfs-utils
mkdir -p /root/data/disk
chmod 600 /root/data/disk/

vim /etc/exports
/root/data/disk/ *(rw,no_root_squash,no_all_squash,sync)
exportfs -rv

先启动rpc服务,再启动nfs服务

ubuntu: systemctl restart nfs-kernel-server

centos:
systemctl restart rpcbind.service
systemctl status rpcbind.service
systemctl restart nfs-server.service
systemctl status nfs-server.service

cat /var/lib/nfs/etab
showmount -e localhost

放通端口ALL,包括udp tcp

客户端

centos: yum -y install nfs-utils # 安装nfs
ubuntu: apt-get install nfs-common
mkdir -p /data/nfs && chmod 666 /data/nfs # -p 级联创建,创建指定共享目录,并修改相应权限

showmount -e nfs_ip
mount -t nfs nfs_ip:/root/data/disk /data/nfs # 将服务nfs目录挂载至客户端目录

umount /data/nfs
如果提示busy,则yum install -y psmisc 后 fuser -m -v /data/nfs

二、使用本地磁盘

kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.31/deploy/local-path-storage.yaml

使用:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-path-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 128Mi
**只支持ReadWriteOnce**

三、安装k8s

sealos安装

查看版本:

curl --silent "https://api.github.com/repos/labring/sealos/releases" | jq -r '.[].tag_name'

选择版本

VERSION=v5.0.0
curl -sfL https://mirror.ghproxy.com/https://raw.githubusercontent.com/labring/sealos/main/scripts/install.sh | PROXY_PREFIX=https://mirror.ghproxy.com sh -s ${VERSION} labring/sealos

sealos安装


镜像来源于
https://explore.ggcr.dev/

sealos run registry.cn-shanghai.aliyuncs.com/labring/kubernetes-docker:v1.28.0
sealos run registry.cn-shanghai.aliyuncs.com/labring/helm:v3.9.4
sealos run registry.cn-shanghai.aliyuncs.com/labring/calico:3.26.1

四、部署kuboard

部署deployment

curl -fsSL https://addons.kuboard.cn/kuboard/kuboard-static-pod.sh -o kuboard.sh
vi kuboard.sh
替换KUBOARD_ENDPOINT hostPort为自定义端口(比如30080)
sh kuboard.sh

初始化集群

api地址:https://kubernetes.default.svc.cluster.local:6443
配置文件: /root/.kube/config
安装metrics-scraper
安装metricsServer
安装存储资源

五、部署harbor

添加harbor仓库

helm repo add harbor https://helm.goharbor.io

查看harbor最新版本

helm search repo harbor -l | grep harbor/harbor | head -4

拉取并解压

helm pull harbor/harbor --version 1.13.0
tar -zxvf ...

修改values.yaml

1.更改expose下面的type字段
2.更改hosts>core,externalURL地址
3.修改ingress classname
4.更改storageclass
5.multipartcopythresholdsize 默认32M,需要修改

创建

kubectl create namespace harbor
helm install harbor harbor/harbor -n harbor -f values.yaml

最后修改:2025 年 02 月 22 日
如果觉得我的文章对你有用,请随意赞赏