How to map the current directory in the volume of kubernetes?

4/11/2019

I need to map the current directory to a volume of Kubernetes on windows.

I can do this using hostPath, but I can not get the current directory in my deployment.

Usually we use ./ to pass the current directory but kubernetes does not recognize it.

How can I use the corresponding ./ in windows kubernetes?

Here's the way I'm trying to do:

apiVersion: apps/v1
kind: Deployment
metadata:
name: testeleitor
labels:
    app: leitoreventos
spec:
selector:
    matchLabels:
    app: leitoreventos
    tier: backend
replicas: 1
template:
    metadata:
    labels: 
        app: leitoreventos
        tier: backend
    spec:
    restartPolicy: Always
    containers:
    - image: leitordeeventos:v1.6.1
        name: leitor
        ports:
        - containerPort: 5555 
        volumeMounts:
        - mountPath: /home/binarios/test/
          name: test-volume
    volumes:
    - name: test-volume
      hostPath:
        path: ./test/
        type: Directory
-- Gladson Bruno
kubernetes

0 Answers