kubernetes on minikube can't output to file kubernetes on minikube can't output to file kubernetes kubernetes

kubernetes on minikube can't output to file


Your job should like like this:

apiVersion: batch/v1kind: Jobmetadata:  name: pi13spec:  template:    spec:      containers:      - name: pi        image: perl        command: [ "sh", "-c"]        args: ["echo 1 >> /data/text12.txt"]        volumeMounts:        - mountPath: /data          name: data      volumes:        - name: data          hostPath:            path: /tmp/data      restartPolicy: Never  backoffLimit: 1

In your case you pass whole 1 >> /data/text12.txt to echo command and as results it prints 1 >> /data/text12.txt what you can check in job logs.

hostPath creates directory /data, so this is why you found it.

I hope it helps.