Q: kubectl run a docker image by bind mount way

5/27/2020

I want to run docker with k8s, docker command as follow

docker run -d -it --rm \
 --mount type=bind,source=/search/odin/mountp,target=/search/odin/mountp,bind-propagation=rshared \
 --cap-add SYS_ADMIN --device /dev/fuse --net=host demo:1.1 /bin/bash

As if kubectl not support --mount arg. How should write .yaml file?

-- xue xue
kubectl
kubernetes
yaml

1 Answer

5/28/2020

kubectl does support mount via volume (https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/)

apiVersion: v1
kind: Pod
metadata:
  name: redis
spec:
  containers:
  - name: redis
    image: redis
    volumeMounts:
    - name: redis-storage
      mountPath: /data/redis
  volumes:
  - name: redis-storage
    emptyDir: {}

Go through it first and adjust accordingly.

-- BMW
Source: StackOverflow