探索 Azure Kubernetes 卷内容
Explore Azure Kubernetes Volume Content
有什么方法可以连接到 Kubernetes 集群上的卷并探索其中的内容。
首先,创建一个PersistentVolumeClaim和Pod来挂载volume
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
然后执行到 Pod 并开始探索
$ kubectl exec -it volume-inspector bash
root@volume-inspector:/# ls /tmp/mount
有什么方法可以连接到 Kubernetes 集群上的卷并探索其中的内容。
首先,创建一个PersistentVolumeClaim和Pod来挂载volume
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
然后执行到 Pod 并开始探索
$ kubectl exec -it volume-inspector bash
root@volume-inspector:/# ls /tmp/mount