部署Trident
适用于Docker的Trident可与适用于NetApp存储平台的Docker生态系统直接集成。它支持从存储平台到 Docker 主机的存储资源配置和管理,并提供一个框架,用于在未来添加其他平台。
多个Trident实例可以同时在同一主机上运行。这样可以同时连接到多个存储系统和存储类型,并能够自定义用于 Docker 卷的存储。
请参见"部署的前提条件"。确保满足这些前提条件后、即可部署Trident。
Docker 托管插件方法( 1.13/17.03 及更高版本)
|
|
开始之前
如果在传统守护进程方法中使用的是Trident Docker 1.3/17.03之前的版本、请确保先停止Trident进程并重新启动Docker守护进程、然后再使用托管插件方法。
|
-
停止所有正在运行的实例:
pkill /usr/local/bin/netappdvp pkill /usr/local/bin/trident -
重新启动 Docker 。
systemctl restart docker -
确保已安装 Docker 引擎 17.03 (新版本 1.13 )或更高版本。
docker --version如果您的版本已过期, "安装或更新安装"。
-
创建配置文件并按如下所示指定选项:
-
config:默认文件名为config.json,但您可以使用所选的任何名称,方法是使用文件名指定config选项。此配置文件必须位于主机系统上的 ` /etc/netappdvp` 目录中。 -
log-level:指定日志记录级别(debug,info,warn,error,fal)。默认值为info。 -
debug:指定是否启用调试日志记录。默认值为 false 。如果为 true ,则覆盖日志级别。-
为配置文件创建一个位置:
sudo mkdir -p /etc/netappdvp -
创建配置文件:
cat << EOF > /etc/netappdvp/config.json{ "version": 1, "storageDriverName": "ontap-nas", "managementLIF": "10.0.0.1", "dataLIF": "10.0.0.2", "svm": "svm_nfs", "username": "vsadmin", "password": "password", "aggregate": "aggr1" } EOF
-
-
-
使用受管插件系统启动Trident。请替换 `<version>`为您正在使用的插件版本(xxx.xx.x)。
docker plugin install --grant-all-permissions --alias netapp netapp/trident-plugin:<version> config=myConfigFile.json -
开始使用Trident使用已配置系统中的存储。
-
创建名为 "firstVolume" 的卷:
docker volume create -d netapp --name firstVolume -
在容器启动时创建默认卷:
docker run --rm -it --volume-driver netapp --volume secondVolume:/my_vol alpine ash -
删除卷 "firstVolume" :
docker volume rm firstVolume
-
传统方法( 1.12 或更早版本)
-
确保您已安装 Docker 版本 1.10 或更高版本。
docker --version如果您的版本已过期,请更新您的安装。
curl -fsSL https://get.docker.com/ | sh -
确保已为您的系统配置 NFS 和 / 或 iSCSI 。
-
安装和配置 NetApp Docker 卷插件:
-
下载并解压缩应用程序:
----trident-installer-26.10.1.tar.gz wget https://github.com/NetApp/trident/releases/download/10.0/ tar zxf trident-installer-26.10.1.tar.gz
-
.. Move to a location in the bin path: + [source,console]
sudo mv trident-installer/extras/bin/trident /usr/local/bin/ sudo chown root:root /usr/local/bin/trident sudo chmod 755 /usr/local/bin/trident
.. Create a location for the configuration file: + [source,console]
sudo mkdir -p /etc/netappdvp
.. Create the configuration file: + [source,console]
cat << EOF > /etc/netappdvp/ontap-nas.json
+ [source,json]
{ "version": 1, "storageDriverName": "ontap-nas", "managementLIF": "10.0.0.1", "dataLIF": "10.0.0.2", "svm": "svm_nfs", "username": "vsadmin", "password": "password", "aggregate": "aggr1" } EOF
. After placing the binary and creating the configuration file, start the Trident daemon using the desired configuration file. + [source,console]
sudo trident --config=/etc/netappdvp/ontap-nas.json
+ NOTE: Unless specified, the default name for the volume driver is "netapp". + After the daemon is started, you can create and manage volumes by using the Docker CLI interface. . Create a volume: + [source,console]
docker volume create -d netapp --name trident_1
. Provision a Docker volume when starting a container: + [source,console]
docker run --rm -it --volume-driver netapp --volume trident_2:/my_vol alpine ash
. Remove a Docker volume: + [source,console]
docker volume rm trident_1
+ [source,console]
docker volume rm trident_2
== Start Trident at system startup A sample unit file for systemd based systems can be found at `contrib/trident.service.example` in the Git repo. To use the file with RHEL, do the following: . Copy the file to the correct location. + You should use unique names for the unit files if you have more than one instance running. + [source,console]
cp contrib/trident.service.example /usr/lib/systemd/system/trident.service
. Edit the file, change the description (line 2) to match the driver name and the configuration file path (line 9) to reflect your environment. . Reload systemd for it to ingest changes: + [source,console]
systemctl daemon-reload
. Enable the service. + This name varies depending on what you named the file in the `/usr/lib/systemd/system` directory. + [source,console]
systemctl enable trident
. Start the service. + [source,console]
systemctl start trident
. View the status. + [source,console]
systemctl status trident
NOTE: Any time you modify the unit file, run the `systemctl daemon-reload` command for it to be aware of the changes.