I am learning how to use volume with pods in K8s.
I tried the exact example here.
This is the snippet
apiVersion: v1 kind: Pod metadata: name: test-pd spec: containers: - image: k8s.gcr.io/test-webserver name: test-container volumeMounts: - mountPath: /test-pd name: test-volume volumes: - name: test-volume hostPath: # directory location on host path: /data # this field is optional type: Directory
I simply copied pasted it and run it with
kubectl apply -f <file>
kubectl get pods shows status hangs ContainerCreating
I have two questions
- How to make the pod run as expected?
- How to troubleshoot this situation? using
kubectl logs <podname>doesn't yield anything useful