Reputation: 453
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.
I need to access and manage my output directory on Azure cluster. In other words, I need a savior.
Upvotes: 22
Views: 25279
Reputation: 5138
As I've explained here and 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, e.g., 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
Alternatively, I've created a templating service to simplify these kind of tasks:
kubectl apply -f 'https://k8s.sauerburger.com/t/pvc-inspect.yaml?image=busybox&name=pvc-inspector&pvc=YOUR_CLAIM_NAME_HERE'
Inspect the contents
kubectl exec -it pvc-inspector -- sh
$ ls /pvc
Clean Up
kubectl delete pod pvc-inspector
Upvotes: 31