Kubernetes Hostpath External Provisioner fails to instantiate in a POD: Failed to create config

5/4/2017

I am trying to deploy hostpath external provisioner POD on a single-node Kubernetes cluster v1.5.1. I built the provisioner image in my workstation, saved the docker image to a tar file and loaded it on my single-node K8S cluster and the image loaded successfully. However when I try to create a POD using it, POD goes into CrashLoopBackOff, and when I check the POD logs, I see the following error:

Failed to create config: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory

I guess this error is thrown from the following line in hostpath-provisioner.go's main() function:

config, err := rest.InClusterConfig()

My pod definition is here:

kind: Pod
apiVersion: v1
metadata:
  name: hostpath-provisioner
spec:
  containers:
    - name: hostpath-provisioner
      image: hostpath-provisioner:latest
      imagePullPolicy: "Never"
      env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
      volumeMounts:
        - name: pv-volume
          mountPath: /tmp/hostpath-provisioning
  volumes:
    - name: pv-volume
      hostPath:
        path: /tmp/hostpath-provisioning

Am I missing something?

-- msbl3004
external
kubernetes
provisioning

0 Answers