简体   繁体   English

探索 Azure Kubernetes 卷内容

[英]Explore Azure Kubernetes Volume Content

有什么方法可以连接到附加到 Kubernetes 集群的卷并探索其中的内容。

First, create a PersistentVolumeClaim and Pod to mount the volume首先,创建一个 PersistentVolumeClaim 和 Pod 来挂载卷

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeName: <the-volume-that-you-want-to-explore>
  resources:
    requests:
      storage: 3Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: volume-inspector
spec:
  containers:
    - name: foo
      command: ["sleep","infinity"]
      image: ubuntu:latest
      volumeMounts:
      - mountPath: "/tmp/mount"
        name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: my-claim
        readOnly: true

Then exec into the Pod and start exploring然后 exec 进入 Pod 并开始探索

$ kubectl exec -it volume-inspector bash
root@volume-inspector:/# ls /tmp/mount

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM