安裝 Trident Protect CLI 外掛程式
您可以使用 Trident Protect 命令列外掛程式( Trident tridentctl 實用程式的擴充功能)來建立和與 Trident Protect 自訂資源( CR )進行互動。
安裝 Trident Protect CLI 外掛程式
在使用命令列實用程式之前,需要將其安裝到用於存取叢集的電腦上。請根據您的電腦使用的是 x64 還是 ARM CPU,依照以下步驟操作。
-
下載 Trident Protect CLI 外掛程式:
curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/25.10.0/tridentctl-protect-linux-amd64
-
下載 Trident Protect CLI 外掛程式:
curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/25.10.0/tridentctl-protect-linux-arm64
-
下載 Trident Protect CLI 外掛程式:
curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/25.10.0/tridentctl-protect-macos-amd64
-
下載 Trident Protect CLI 外掛程式:
curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/25.10.0/tridentctl-protect-macos-arm64
-
啟用外掛程式二進位檔案的執行權限:
chmod +x tridentctl-protect -
將插件二進位檔案複製到 PATH 環境變數中定義的某個位置。例如,
/usr/bin或/usr/local/bin(您可能需要管理員權限):cp ./tridentctl-protect /usr/local/bin/ -
您也可以選擇將插件二進位檔案複製到您主目錄下的某個位置。在這種情況下,建議確保該位置已新增至您的 PATH 環境變數:
cp ./tridentctl-protect ~/bin/
|
|
將外掛程式複製到 PATH 變數中的某個位置,即可透過鍵入 tridentctl-protect 或 tridentctl protect 從任何位置使用該外掛程式。
|
查看 Trident CLI 外掛程式說明
您可以使用內建的外掛程式說明功能,以取得外掛程式功能的詳細說明:
-
使用說明功能檢視使用指南:
tridentctl-protect help
啟用命令自動完成
安裝 Trident Protect CLI 外掛程式後、您可以為某些命令啟用自動完成功能。
-
建立完成指令碼:
tridentctl-protect completion bash > tridentctl-completion.bash -
在您的使用者目錄下建立一個新目錄,用於存放腳本:
mkdir -p ~/.bash/completions -
將下載的腳本移至
~/.bash/completions目錄:mv tridentctl-completion.bash ~/.bash/completions/ -
將以下行新增至您主目錄中的
~/.bashrc檔案:source ~/.bash/completions/tridentctl-completion.bash
-
建立完成指令碼:
tridentctl-protect completion zsh > tridentctl-completion.zsh -
在您的使用者目錄下建立一個新目錄,用於存放腳本:
mkdir -p ~/.zsh/completions -
將下載的腳本移至
~/.zsh/completions目錄:mv tridentctl-completion.zsh ~/.zsh/completions/ -
將以下行新增至您主目錄中的
~/.zprofile檔案:source ~/.zsh/completions/tridentctl-completion.zsh
下次登入 shell 時、您可以使用 tridentctl-protect 外掛程式進行命令自動完成。