客户端以daemonSet的形式部署,yaml文件如下:
配置文件我们以configMap的形式挂载,所以我们还需要编写一个configMap的yaml文件,如下:
apiVersion: v1 kind: ConfigMap metadata: name: dragonfly-conf namespace: kube-system data: dfget.yml: | nodes: - 172.17.100.120部署过后观察结果
# kubectl get pod -n kube-system | grep dfdaemon dfdaemon-mj4p6 1/1 Running 0 3m51s dfdaemon-wgq5d 1/1 Running 0 3m51s dfdaemon-wljt6 1/1 Running 0 3m51s
然后修改docker daemon的配置,如下:
重启docker
systemctl restart docker
现在我们来拉取镜像测试,并观察日志输出。
下载镜像(在master上测试的):
然后观察日志
kubectl exec -n kube-system dfdaemon-wgq5d grep 'downloading piece' /root/.small-dragonfly/logs/dfclient.log看到日志输出如下,表示成功
2020-06-20 17:14:54.578 INFO sign:128-1592673287.190 : downloading piece:{"taskID":"089dc52627a346df2a2ff67f6c07497167b35c4bad2bca1e9aad087441116982","superNode":"172.17.100.120","dstCid":"cdnnode:192.168.235.192~089dc52627a346df2a2ff67f6c07497167b35c4bad2bca1e9aad087441116982","range":"0-4194303","result":503,"status":701,"pieceSize":4194304,"pieceNum":0}今天的测试就到这里,我这是自己的小集群实验室,效果其实并不明显,在大集群效果可能更好。
参考
https://d7y.io/zh-cn/docs/userguide/multi_machines_deployment.html