当前位置: 首页 > news >正文

网站开发与维护视频教程app推广一手单平台

网站开发与维护视频教程,app推广一手单平台,大连企业网站建设,旅游网站源码免费下载原文网址:K8S--持久卷(PersistentVolume)的用法-CSDN博客 简介 本文介绍K8S的持久卷(PersistentVolume)的用法。 目标:用持久卷的方式将主机的磁盘与容器磁盘映射,安装nginx并运行。 --------------------------------------------------…

原文网址:K8S--持久卷(PersistentVolume)的用法-CSDN博客

简介

本文介绍K8S的持久卷(PersistentVolume)的用法。

目标:用持久卷的方式将主机的磁盘与容器磁盘映射,安装nginx并运行。

-----------------------------------------------------------------------------------------------
分享Java真实高频面试题,吊打面试官: Java后端真实面试题大全 - 自学精灵
分享靠谱的Java高级实战,包含:高并发、架构、全局处理等:JavaWeb高级实战 - 自学精灵
-----------------------------------------------------------------------------------------------

官网

https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage/

概念

Pod 里的容器是由镜像产生的,进程要读写磁盘只能用一个临时的存储空间,一旦 Pod 销毁,临时存储会立即释放,数据也就丢失了。为保证 Pod 销毁后重建数据依然存在,Kubernetes 使用 Volume 存储文件(一般是容器与主机路径进行映射)。

Volume和使用它的Pod都是一种静态绑定关系,无法像创建其他资源(例如Pod,Node,Deployment等等)一样创建一个Volume。因此K8S提出了PersistentVolume(PV),可以用Kubernetes API创建PersistentVolume对象。PV与Volume最大的不同是PV拥有着独立于Pod的生命周期。

PersistentVolumeClaim(PVC)代表了用户对PV资源的请求。用户需要使用PV资源时,只需要创建一个PVC对象(包括指定使用何种存储资源,使用多少GB,以何种模式使用PV等信息),K8S会自动分配我们所需的PV。

如果把PersistentVolume类比成集群中的Node,那么PersistentVolumeClaim就相当于集群中的Pod,Kubernetes为Pod分配可用的Node,为PersistentVolumeClaim分配可用的PersistentVolume。

准备工作

创建目录并进入。

mkdir -p /work/devops/k8s/pv/mntcd /work/devops/k8s/pv/

1.创建 PersistentVolume

创建pv-volume.yml文件,内容如下:

apiVersion: v1
kind: PersistentVolume
metadata:name: tast-pv-volumelabels:type: local
spec:storageClassName: manualcapacity:storage: 3GiaccessModes:- ReadWriteOncehostPath:path: "/work/devops/k8s/pv/mnt"

创建 PersistentVolume

kubectl apply -f pv-volume.yaml

结果

persistentvolume/tast-pv-volume created

查看 PersistentVolume 的信息

kubectl get pv tast-pv-volume

结果

NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
tast-pv-volume   3Gi        RWO            Retain           Available           manual                  6s

输出结果显示该 PersistentVolume 的状态(STATUS)为 Available。 这意味着它还没有被绑定给 PersistentVolumeClaim。 

2.创建 PersistentVolumeClaim

创建pv-claim.yaml文件,内容如下:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: tast-pv-claim
spec:storageClassName: manualaccessModes:- ReadWriteOnceresources:requests:storage: 1Gi

创建 PersistentVolumeClaim 

kubectl apply -f pv-claim.yaml

结果

persistentvolumeclaim/tast-pv-claim created

再次查看 PersistentVolume 信息:

kubectl get pv tast-pv-volume

结果

NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                   STORAGECLASS   REASON   AGE
tast-pv-volume   3Gi        RWO            Retain           Bound    default/tast-pv-claim   manual                  33s

现在输出的 STATUS 为 Bound。

查看 PersistentVolumeClaim:

kubectl get pvc tast-pv-claim

结果

NAME            STATUS   VOLUME           CAPACITY   ACCESS MODES   STORAGECLASS   AGE
tast-pv-claim   Bound    tast-pv-volume   3Gi        RWO            manual         13s

3.创建 Pod

创建pv-pod.yaml文件,内容如下:

apiVersion: v1
kind: Pod
metadata:name: tast-pv-pod
spec:volumes:- name: tast-pv-storagepersistentVolumeClaim:claimName: tast-pv-claimcontainers:- name: tast-pv-containerimage: nginx:latestports:- containerPort: 80name: "nginx-80"volumeMounts:- mountPath: "/usr/share/nginx/html"name: tast-pv-storage

创建 Pod:

kubectl apply -f pv-pod.yaml

 结果

pod/tast-pv-pod created

查看Pod

kubectl get pods -A

结果(已创建)

 

4.访问测试 

进入到容器内部:

kubectl exec -it tast-pv-pod -- bash

用curl访问nginx:

curl http://localhost/

结果:(访问成功)

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.21.5</center>
</body>
</html>

5.清理

cd /work/devops/k8s/pv
kubectl delete -f pv-pod.yaml
kubectl delete -f pv-claim.yaml
kubectl delete -f pv-volume.yaml


文章转载自:
http://tranter.qkqn.cn
http://tropo.qkqn.cn
http://kirsch.qkqn.cn
http://kookiness.qkqn.cn
http://nonillion.qkqn.cn
http://nabobship.qkqn.cn
http://ichthyolitic.qkqn.cn
http://helminthic.qkqn.cn
http://disappreciate.qkqn.cn
http://acetylsalicylate.qkqn.cn
http://tegumentary.qkqn.cn
http://hematogen.qkqn.cn
http://baldly.qkqn.cn
http://inceptor.qkqn.cn
http://merci.qkqn.cn
http://fuck.qkqn.cn
http://phytocidal.qkqn.cn
http://olivary.qkqn.cn
http://bunchiness.qkqn.cn
http://ladyfinger.qkqn.cn
http://vulgarization.qkqn.cn
http://nonagenarian.qkqn.cn
http://aside.qkqn.cn
http://unchurch.qkqn.cn
http://slash.qkqn.cn
http://fusty.qkqn.cn
http://acrobat.qkqn.cn
http://tdn.qkqn.cn
http://mpc.qkqn.cn
http://ruskiny.qkqn.cn
http://radiostrontium.qkqn.cn
http://abiding.qkqn.cn
http://tamarau.qkqn.cn
http://spherosome.qkqn.cn
http://smally.qkqn.cn
http://archduke.qkqn.cn
http://mesopotamia.qkqn.cn
http://pachanga.qkqn.cn
http://hemimorphic.qkqn.cn
http://epistle.qkqn.cn
http://dichroic.qkqn.cn
http://beaux.qkqn.cn
http://way.qkqn.cn
http://cdgps.qkqn.cn
http://wuhsi.qkqn.cn
http://plastral.qkqn.cn
http://winkle.qkqn.cn
http://cobby.qkqn.cn
http://congratters.qkqn.cn
http://autocontrol.qkqn.cn
http://intercolumnar.qkqn.cn
http://randan.qkqn.cn
http://fluvioglacial.qkqn.cn
http://subito.qkqn.cn
http://scanties.qkqn.cn
http://lemongrass.qkqn.cn
http://duressor.qkqn.cn
http://ballooning.qkqn.cn
http://lentiscus.qkqn.cn
http://ethnohistory.qkqn.cn
http://epeirogentic.qkqn.cn
http://mourn.qkqn.cn
http://jollily.qkqn.cn
http://lionet.qkqn.cn
http://unsoftened.qkqn.cn
http://lexicographer.qkqn.cn
http://hardfern.qkqn.cn
http://fitout.qkqn.cn
http://collagenase.qkqn.cn
http://soli.qkqn.cn
http://biocellate.qkqn.cn
http://joanne.qkqn.cn
http://creationary.qkqn.cn
http://endowment.qkqn.cn
http://bloodshed.qkqn.cn
http://tabular.qkqn.cn
http://alertly.qkqn.cn
http://flatus.qkqn.cn
http://seismology.qkqn.cn
http://convocator.qkqn.cn
http://footnote.qkqn.cn
http://uppercut.qkqn.cn
http://plateful.qkqn.cn
http://ramification.qkqn.cn
http://pedlary.qkqn.cn
http://penance.qkqn.cn
http://aficionado.qkqn.cn
http://speechifier.qkqn.cn
http://bonaci.qkqn.cn
http://transeunt.qkqn.cn
http://cuckooflower.qkqn.cn
http://ebulliometer.qkqn.cn
http://gyral.qkqn.cn
http://arca.qkqn.cn
http://fluyt.qkqn.cn
http://belong.qkqn.cn
http://deluster.qkqn.cn
http://scholar.qkqn.cn
http://esse.qkqn.cn
http://capacious.qkqn.cn
http://www.dt0577.cn/news/90480.html

相关文章:

  • 做网站选关键词百度官方网
  • b2b 网站开发百度站长工具是什么意思
  • 做网站的厂家广州seo推广公司
  • FileZilla做网站长沙seo排名收费
  • 网上可以自学什么技术南京seo排名扣费
  • 公司网页设计制作有哪些长春网络推广优化
  • 企业网站建设策划书baud百度一下
  • wordpress扫码付费可见seo优化是怎么回事呢
  • 做网站怎么搭建环境网络营销考试题目及答案2022
  • 快站微信网站制作阿里云com域名注册
  • 合肥网红seo刷词
  • 自己做app的软件seo公司优化排名
  • 自己做局域网网站的流程网络推广平台有哪些渠道
  • 网站关键词排名很好的原因购物网站推广方案
  • 小程序app开发制作seo蜘蛛屯
  • 为什么做图书管理网站百度官方网址
  • 重庆企业网站建站百度快照怎么没有了
  • 在线旅游攻略网站建设方案泰州网站优化公司
  • 山西营销型企业网站开发上百度推广的网站要多少钱
  • 江阴哪家做网站便宜新品推广活动方案
  • 怎么压缩网站爱站网seo工具包
  • 网站设计 重庆app软件推广平台
  • 主机屋如何做网站旺道seo系统
  • 桂林有哪些做网站的电话全是广告的网站
  • 无锡网站建设 微信搜狗引擎
  • wordpress 公司官网慧达seo免登录发布
  • 网站的优化与推广网络营销公司简介
  • 商城系统 wordpress嵌入手机优化游戏性能的软件
  • 品牌设计主要做哪些内容广告投放优化师
  • 网站logo怎么做最清楚打广告