$ sudo apt install -y cifs-utils jq util-linux coreutils
不支持 Docker Desktop k8s
以 Daemonset 方式部署
KUBELET_PLUGINS_VOLUME_PATH为kubelet--volume-plugin-dir=参数指定的值
Linux/macOS 请执行如下命令:
# $ KUBELET_PLUGINS_VOLUME_PATH=${K8S_ROOT:-/opt/k8s}/var/lib/kubelet/kubelet-plugins/volume/exec/
$ KUBELET_PLUGINS_VOLUME_PATH="/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
$ sed "s%##KUBELET_PLUGINS_VOLUME_PATH##%${KUBELET_PLUGINS_VOLUME_PATH:?value empty}%g" deploy.yaml | kubectl apply -f -
Windows 请执行如下命令:
$ PS:> $KUBELET_PLUGINS_VOLUME_PATH="/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
$ PS:> (get-content deploy.yaml) -Replace "##KUBELET_PLUGINS_VOLUME_PATH##",${KUBELET_PLUGINS_VOLUME_PATH} | kubectl apply -f -
配置 flexvolume-cifs-secret.yaml
生成用户名及密码
$ echo -n username | base64
$ echo -n password | base64
apiVersion: v1
kind: Secret
metadata:
name: flexvolume-cifs-secret
namespace: default
type: fstab/cifs
data:
username: 'ZXhhbXBsZQ==' # 自行替换
password: 'bXktc2VjcmV0LXBhc3N3b3Jk' # 自行替换
$ kubectl apply -f flexvolume-cifs-secret.yaml
pod.yaml中替换//HIWIFI/sd/xunlei为网络路径
$ kubectl apply -f tests/pod.yaml
进入 pod/flexvolume-tests-busybox 的 /data 目录,新建文件.之后在 CIFS 服务端查看文件是否存在.具体步骤不再赘述
Windows 盘符开启共享请查看 这里
网络路径则为: //192.168.199.100//c
192.168.199.100 为 Windows IP
# 用 用户/密码 登录
$ mount -t cifs //<host>/<path> /<localpath> -o user=<user>,password=<user>
# 用 游客 登录
$ mount -t cifs //<host>/<path> /<localpath> -o guest
Content type
Image
Digest
Size
745.1 kB
Last updated
almost 7 years ago
docker pull dockerpracticesig/flexvolume-cifs