简体   繁体   中英

how to inspect the content of persistent volume by kubernetes on azure cloud service

I have packed the software to a container. I need to put the container to cluster by Azure Container Service. The software have outputs of an directory /src/data/ , I want to access the content of the whole directory.

After searching, I have to solution.

  1. use Blob Storage on azure, but then after searching, I can't find the executable method.
  2. use Persistent Volume, but all the official documentation of azure and pages I found is about Persistent Volume itself, not about how to inspect it.

I need to access and manage my output directory on Azure cluster. In other words, I need a savior.

As I've explained here , in general, if you can interact with the cluster using kubectl , you can create a pod/container, mount the PVC inside, and use the container's tools to, eg, ls the contents. If you need more advanced editing tools, replace the container image busybox with a custom one.

Create the inspector pod

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: pvc-inspector
spec:
  containers:
  - image: busybox
    name: pvc-inspector
    command: ["tail"]
    args: ["-f", "/dev/null"]
    volumeMounts:
    - mountPath: /pvc
      name: pvc-mount
  volumes:
  - name: pvc-mount
    persistentVolumeClaim:
      claimName: YOUR_CLAIM_NAME_HERE
EOF

Inspect the contents

kubectl exec -it pvc-inspector -- sh
$ ls /pvc

Clean Up

kubectl delete pod pvc-inspector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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