查找pod使用的物理目录位置
例子:找出当前pod挂载的是哪个物理目录
# 先查看pod web-0 的yaml文件
# kubectl get pod web-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2020-02-07T12:06:07Z"
generateName: web-
labels:
app: nginx
controller-revision-hash: web-8d6d99dc7
statefulset.kubernetes.io/pod-name: web-0
name: web-0
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: StatefulSet
name: web
uid: fb8eb881-a311-426f-8734-17457effaa12
resourceVersion: "524897"
selfLink: /api/v1/namespaces/default/pods/web-0
uid: ea5ff673-2791-4ee1-8ec2-713516e1bd9d
spec:
containers:
- image: hub.zhoushiya.top/test/nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
name: web
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/nginx/html
name: www
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-75xfr
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
hostname: web-0
nodeName: k8s-node01
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
subdomain: nginx
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: www #确定此处挂载的目录是www
persistentVolumeClaim:
claimName: www-web-0 #使用的pvc名称叫做www-web-0
- name: default-token-75xfr
secret:
defaultMode: 420
secretName: default-token-75xfr
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2020-02-07T12:06:26Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2020-02-07T12:06:28Z"
status: "True"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2020-02-07T12:06:28Z"
status: "True"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2020-02-07T12:06:09Z"
status: "True"
type: PodScheduled
containerStatuses:
- containerID: docker://5ada7f2cfa1bdd4520b15de6efeae1fc96f0a98596a55e8dae349ddb4894a339
image: hub.zhoushiya.top/test/nginx:latest
imageID: docker-pullable://hub.zhoushiya.top/test/nginx@sha256:401ff5d136d690b2eaf61055aabdb7b4bc2ed8114fb5e423963249db7ac0188e
lastState: {}
name: nginx
ready: true
restartCount: 0
started: true
state:
running:
startedAt: "2020-02-07T12:06:28Z"
hostIP: 192.168.66.20
phase: Running
podIP: 10.244.1.67
podIPs:
- ip: 10.244.1.67
qosClass: BestEffort
startTime: "2020-02-07T12:06:26Z"
# 确定了pvc叫做www-web-0,再去查看pvc的yaml
# kubectl get pvc www-web-0
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
www-web-0 Bound nfspv2 2Gi RWO nfs 17h
# 确定了现在使用的pv是nfspv2,再去查看pv nfspv2的yaml
# kubectl get pv nfspv2 -o yaml
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"name":"nfspv2"},"spec":{"accessModes":["ReadWriteOnce"],"capacity":{"storage":"2Gi"},"nfs":{"path":"/nfsdata2","server":"192.168.66.100"},"persistentVolumeReclaimPolicy":"Retain","storageClassName":"nfs"}}
pv.kubernetes.io/bound-by-controller: "yes"
creationTimestamp: "2020-02-07T11:14:36Z"
finalizers:
- kubernetes.io/pv-protection
name: nfspv2
resourceVersion: "524873"
selfLink: /api/v1/persistentvolumes/nfspv2
uid: c239574e-387c-4532-a1ee-5e9c8a8b8376
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 2Gi
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: www-web-0
namespace: default
resourceVersion: "524868"
uid: b4674789-dd10-4d01-99bf-ebc69dde5dad
nfs:
path: /nfsdata2 #这就是使用的目录了
server: 192.168.66.100 #这是目录的主机
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs
volumeMode: Filesystem
status:
phase: Bound
可以看到最后结果是192.168.66.100:/nfsdata2/目录挂载到了pod的/usr/share/nginx/html/下面
查找pod使用的物理目录位置的更多相关文章
- IIS7多域名绑定同一物理目录,设置不同默认文档的解决方案
转载自 http://zzstudy.offcn.com/archives/6159 如何解决IIS7多域名绑定同一物理目录,设置不同的默认文档的问题? 因为在一个物理目录下只有一个web.confi ...
- Unity3d:播放物理目录下的MP3文件
u3d里,是支持播放MP3文件的,但要放到资源里,不支持播放物理目录下的MP3文件.由于界面上无需显示,只是当作背景音乐来播放,所以想到调用c#的组件来解决此问题.主要代码都在附件中,根据需要加到自己 ...
- 确定当前Python环境中的site-packages目录位置
引入“搜索路径”这个概念是因为在使用import语句时,当解释器遇到import语句,如果模块在当前的搜索路径就会被导入. 搜索路径是一个解释器会先进行搜索的所有目录的列表. 那么python如何添加 ...
- Delphi通过查找字符定位TADOQuery数据的位置
通过TADOQuery的方法Locate,输入字符,查找到定位到对应的数据位置,优点快速定位,缺点是只匹配查找到的和第一个位置,无法连续定位下一个! //定位qrymembertype.Locate( ...
- IIS 之 IIS 7及以上多域名或端口绑定同一物理目录并设置不同默认文档
今天在 IIS 7 多端口或域名绑定同一物理目录,设置不同的默认文档遇到问题:同一物理目录的多个站点修改任意一个站点默认文档都会一起更改. 原因:在同一个物理目录下只有一个 web.config,并且 ...
- kubernetes多节点的pod挂载同一个cephfs目录
一.安装cephfs 方法一: 直接进入deploy目录,执行: ceph-deploy --overwrite-conf mds create ceph01:mds-daemon- 上面的ceph0 ...
- SharePoint 2013/2010 在一个列表或文档库内移动列表项,文档和目录位置而保持last modify by 等系统字段保持不变
本文讲述SharePoint 2013/2010 在一个列表或文档库内移动列表项.文档和目录位置而保持last modify by 等系统字段保持不变的解决方式. 近期遇到客户一个需求,在一个列表或文 ...
- 解决IIS7多域名绑定同一物理目录,设置不同的默认文档的问题
IIS7多域名绑定同一物理目录,设置不同的默认文档是没办法设置的,因为在一个物理目录下只有一个web.config,并且IIS7把默认文档设置写在这里,导致所有域名的默认文档设置共享.解决方法:1.进 ...
- 查看mysql的数据库物理存放位置
1.查看mysql的数据库物理存放位置: show global variables like "%datadir%";
随机推荐
- Nginx-2.初学者使用
原文 Nginx有一个master进程和几个worker进程.master进程用来读取和评估配置文件,以及维护worker进程.worker进程用来处理实际的请求.Nginx使用事件模型和基于操作系统 ...
- 【转载】STM32 ST-LINK Utility介绍、下载、安装、使用方法
转载地址:https://blog.csdn.net/ybhuangfugui/article/details/52597133 总结的很好!!! Ⅰ.写在前面本文讲述的内容是STM32 ST-LIN ...
- 普通台式机装centos7系统
一.环境 台式机配置如下: 配置:CPU -i5-7400 内存:8G 硬盘:1T 原装系统: win7 64x 使用软碟通刻录U盘做系统启动盘,教程: 教你用UltraISO+U盘制作启动盘和安装各 ...
- codewars--js--Simple string expansion+ repeat(),includes()方法
问题描述: Consider the following expansion: solve("3(ab)") = "ababab" -- "ab&qu ...
- Android Gradle报错 (Error:No such property: GradleVersion for class: JetGradlePlugin) 的原因与解决
Error:No such property: GradleVersion for class: JetGradlePlugin 错误原因:IDE 版本(GradlePlugin)和 Gradle 版 ...
- powersploit的两个信息收集的脚本
0x00 简介 powersploit是基于powershell的渗透工具包,里面都是powershell的脚本工具文件.工具包地址:https://github.com/PowerShellMafi ...
- 【STM32H7教程】第47章 STM32H7的FMC总线基础知识和HAL库API
完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第47章 STM32H7的FMC总线基础知识和HA ...
- 快速建立一个Django项目
快速建立一个Django项目 版本说明 一定要先明确好使用的Python版本和所使用包的版本,避免耽误不要的时间 Python==3.6.4 Django==1.11.9 djangoresframe ...
- Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set…
php打印小票错误提示:Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activate ...
- switch 语句 总结笔记
1.switch 语句 语法: switch(expression) { case value1 : statement1; break; case value2 : statement2; brea ...