<p>Below is my kubernetes file and I need to do two things</p>
<ol>
<li>need to mount a folder with a file</li>
<li>need to mount a file with startup script</li>
</ol>
<p>I have on my local /tmp/zoo folder both the files and my zoo folder files never appear in /bitnami/zookeeper inside the pod.</p>
<p>The below is the updated Service,Deployment,PVC and PV</p>
<h2>kubernetes.yaml</h2>
<pre><code>apiVersion: v1
items:
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      kompose.service.type: nodeport
    creationTimestamp: null
    labels:
      io.kompose.service: zookeeper
    name: zookeeper
  spec:
    ports:
    - name: &quot;2181&quot;
      port: 2181
      targetPort: 2181
    selector:
      io.kompose.service: zookeeper
    type: NodePort
  status:
    loadBalancer: {}
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    annotations:
      kompose.service.type: nodeport
    creationTimestamp: null
    name: zookeeper
  spec:
    replicas: 1
    selector:
      matchLabels:
        io.kompose.service: zookeeper
    strategy:
      type: Recreate
    template:
      metadata:
        creationTimestamp: null
        labels:
          io.kompose.service: zookeeper
      spec:
        containers:
        - image: bitnami/zookeeper:3
          name: zookeeper
          ports:
          - containerPort: 2181
          env:
          - name: ALLOW_ANONYMOUS_LOGIN
            value: &quot;yes&quot;
          resources: {}
          volumeMounts:
          - mountPath: /bitnami/zoo
            name: bitnamidockerzookeeper-zookeeper-data
        restartPolicy: Always
        volumes:
        - name: bitnamidockerzookeeper-zookeeper-data
          #hostPath:
            #path: /tmp/tmp1
          persistentVolumeClaim:
            claimName: bitnamidockerzookeeper-zookeeper-data
  status: {}

- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    creationTimestamp: null
    labels:
      io.kompose.service: bitnamidockerzookeeper-zookeeper-data
      type: local
    name: bitnamidockerzookeeper-zookeeper-data
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 100Mi
  status: {}
- apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: foo
  spec:
    storageClassName: manual
    claimRef:
      name: bitnamidockerzookeeper-zookeeper-data
    capacity:
      storage: 100Mi
    accessModes:
      - ReadWriteMany
    hostPath:
      path: /tmp/tmp1
  status: {}
kind: List
metadata: {}

</code></pre>

<p>A service cannot be assigned a volume. In line 4 of your YAML, you specify &quot;Service&quot; when it should be &quot;Pod&quot; and every resource used in Kubernetes must have a name, in metadata you could add it. That should fix the simple problem.</p>
<pre><code>apiVersion: v1
items:
- apiVersion: v1
  kind: Pod  #POD
  metadata:
    name: my-pod  #A RESOURCE NEEDS A NAME
    creationTimestamp: null
    labels:
      io.kompose.service: zookeeper
  spec:
    containers:
    - image: bitnami/zookeeper:3
      name: zookeeper
      ports:
      - containerPort: 2181
      env:
      - name: ALLOW_ANONYMOUS_LOGIN
        value: &quot;yes&quot;
      resources: {}
      volumeMounts:
      - mountPath: /bitnami/zookeeper
        name: bitnamidockerzookeeper-zookeeper-data
    restartPolicy: Always
    volumes:
    - name: bitnamidockerzookeeper-zookeeper-data
      persistentVolumeClaim:
        claimName: bitnamidockerzookeeper-zookeeper-data
  status: {}
</code></pre>
<p>Now, I don't know what you're using but hostPath works exclusively on a local cluster like Minikube. In production things change drastically. If everything is local, you need to have the directory &quot;/ tmp / zoo&quot; in the node, NOTE not on your local pc but inside the node. For example, if you use minikube then you run <code>minikube ssh</code> to enter the node and there copies &quot;/ tmp / zoo&quot;. An excellent guide to this is given in the official kubernetes documentation: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/</a></p>
