0

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>

Running kubectl get pods shows status hangs ContainerCreating

I have two questions

  1. How to make the pod run as expected?
  2. How to troubleshoot this situation? using kubectl logs <podname> doesn't yield anything useful

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.