K8S的StorageClass实战(NFS) (2)

解压得到tomcat文件夹,进入后打开values.yaml文件,找到persistence节点,增加下图红框中的内容:

在这里插入图片描述

在tomcat目录下执行命令:

helm install --name-template tomcat001 -f values.yaml . --namespace hello-storageclass

查看tomcat的pod和service情况,一切正常,并且端口映射到了宿主机的30300:

在这里插入图片描述


7. 浏览器访问宿主机IP:30300,出现tomcat欢迎页面:

在这里插入图片描述


8. 去NFS server检查磁盘使用情况,如下图,可见已分配给tomcat的PVC,并且写入了tomcat的基本数据:

在这里插入图片描述

清理资源

本次实战创建了各种类型的资源,使用下面的命令可以将其全部清理掉:

helm del --purge tomcat001 kubectl delete storageclass managed-nfs-storage kubectl delete deployment nfs-client-provisioner -n hello-storageclass kubectl delete clusterrolebinding run-nfs-client-provisioner kubectl delete serviceaccount nfs-client-provisioner -n hello-storageclass kubectl delete role leader-locking-nfs-client-provisioner -n hello-storageclass kubectl delete rolebinding leader-locking-nfs-client-provisioner -n hello-storageclass kubectl delete clusterrole nfs-client-provisioner-runner kubectl delete namespace hello-storageclass

至此,StorageClass的创建和使用的实战就完成了,如果您在学习kubernetes存储相关的知识,希望本文能给您一些参考;

欢迎关注公众号:程序员欣宸

微信搜索「程序员欣宸」,我是欣宸,期待与您一同畅游Java世界...
https://github.com/zq2599/blog_demos

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wspssf.html