1.2、k8s pv的自动供应,这里虽然也可以利用Ceph耐久化存储,由于我的测试情况设置不足,先拿NFS对有状态的应用实现自动的PV供应。
先筹备一台NFS处事器为K8S提供存储支持
[root@k8s-node3 ~]
# yum -y install nfs-utils
建设共享的目次
[root@k8s-node3 ~]
# mkdir /ifi/kubernetes -p
[root@k8s-node3 ~]
# cat /etc/exports
/ifi/kubernetes
10.4.7.0/
24(rw,no_root_squash)
[root@k8s-node3 kubernetes]
# systemctl start nfs
[root@k8s-node3 ~]
# systemctl enable nfs
而且要在每个Node上安装nfs-utils包,用于mount挂载时用。
[root@k8s-master1 ~]
# mount -t nfs 10.4.7.22:/ifi/kubernetes /mnt
由于K8S不支持NFS动态供应,还需要先安装nfs-client-provisioner插件
修改nfs的处事端地点和挂载的目次,这是我nfs-client的地点,假如警惕的需要将id_rsa.pub给我
git clone git@gitee.com:zhaocheng172/nfs-client.git
[root@k8s-master1 nfs-client]
# kubectl get pod
NAME
READY STATUS RESTARTS AGE
busybox
1/
1
Running
0
35m
nfs-client-provisioner
-86dff449dd
-68ngn
1/
1
Running
0
106s
2、镜像客栈Harbor
2.1安装docker与docker-compose
# wget CentOS/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
# yum install docker-ce -y
# systemctl start docker
# systemctl enable docker
docker-compose的下载地点:
https:/
/docs.docker.com/compose/install/
curl -L
https:/
/github.com/docker/compose/releases/download/1.25.
0/docker-compose-
`uname -s`-
`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
2.2 解压离线包陈设
下载地点:https://github.com/goharbor/harbor
# tar zxvf harbor-offline-installer-v1.10.1.tgz
# cd harbor
# vi harbor.yml
hostname: harbor.zhaocheng.com
# ./prepare
# ./install.sh --with-chartmuseum
# docker-compose ps
--with-chartmuseum 参数暗示启用Charts存储成果。
举办会见:
这个已经启动chart成果
2.3 设置Docker可信任
由于habor未设置https,还需要在node节点上的docker设置可信任。
# cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://38vve9ja.mirror.aliyuncs.com"],
"insecure-registries": [
"harbor.zhaocheng.com"]
}
# systemctl restart docker
3、helm-v3 东西
3.1安装helm东西
[root@k8s-master1 helm]
# wget https://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz
[root@k8s-master1 helm]
# tar xf helm-v3.0.0-linux-amd64.tar.gz
[root@k8s-master1 helm]
# mv linux-amd64/helm /usr/bin/
[root@k8s-master1 helm]
# helm --help
3.2 安装push插件
# git clone https://gitee.com/zhaocheng172/helm-push.git
# tar zxvf helm-push_0.7.1_linux_amd64.tar.gz
# mkdir -p /root/.local/share/helm/plugins/helm-push
# chmod +x bin/*
# mv bin plugin.yaml /root/.local/share/helm/plugins/helm-push
3.3 添加repo
# helm repo add --username admin --password Harbor12345 myrepo