簡介
本文說明如何將Field Network Director(FND)Open Virtualization Appliance(OVA)docker容器升級到較新版本。
將FND OVA分發與PostgreSQL結合使用時,會附帶在Docker容器中運行的FND和霧導向器例項。容器映像不包含任何永久資訊,因為永久資訊儲存在主機本身上,並與容器共用。
問題
缺少用於升級FND/Fog Director容器的文檔和分步指南。
解決方案
以下是升級容器的步驟。
必要條件
- 確保OVA部署的電腦是基於PostgreSQL的FND OVA部署。
從CLI運行此命令:
[root@iot-fnd ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7c32830fa5d9 fogd-image:active "/bin/sh -c '/var/ci…" 5 months ago Up 18 hours fogd-container
5251f66ef0cc fnd-image:active "/bin/sh -c /opt/fnd…" 5 months ago Up 18 hours 0.0.0.0:80->80/tcp, 0.0.0.0:162->162/udp, 0.0.0.0:443->443/tcp, 0.0.0.0:9120-9121->9120-9121/tcp, 0.0.0.0:5683->5683/udp, 0.0.0.0:61624-61626->61624-61626/udp, 0.0.0.0:9124-9125->9124-9125/tcp, 0.0.0.0:61628->61628/udp fnd-container
正如您在以上輸出中所看到的,兩個容器正在使用fgd和fnd映像運行,這確認您具有使用此升級路徑的正確OVA部署。
- 確保電腦可以訪問Internet,並且已配置DNS。
為了測試此情況,請對公共主機名執行ping。
[root@iot-fnd ~]# ping cisco.com -c1
PING cisco.com (72.163.4.161) 56(84) bytes of data.
64 bytes from www1.cisco.com (72.163.4.161): icmp_seq=1 ttl=239 time=152 ms
--- cisco.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 152.709/152.709/152.709/0.000 ms
如果失敗,則很可能在/etc/resolv.conf中沒有配置DNS
- 如果您需要代理來允許HTTPS流量(例如思科實驗室),可以將其新增到以下檔案中:
[root@iot-fnd ~]# vi /etc/systemd/system/docker.service.d/http-proxy.conf
You have mail in /var/spool/mail/root
[root@iot-fnd ~]# cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTPS_PROXY=http://proxy.esl.cisco.com:80"
新增此配置後,請刷新systemd-services並重新啟動Docker:
[root@iot-fnd ~]# systemctl daemon-reload
[root@iot-fnd ~]# systemctl restart docker
查詢版本映像標籤
若要選擇要升級到的版本,最簡單的方法是檢視FND的CCO下載頁面:https://software.cisco.com/download/home/286287993/type/286320249/
您可以看到,檔名包含版本號。
例如,對於寫入時的最新檔案:CISCO-IOTFND-VPI-K9-4.7.0-101.zip,版本號為:4.7.0-101
這是下一步需要提供的影象標籤。
執行升級
為了進行升級,滿足先決條件後,您只需在/opt/fnd/scripts/upgrade.sh中運行指令碼
運行指令碼時,請首先選擇選項1)載入容器映像
作為devhub-docker.cisco.com的憑據,您可以使用以下內容:
使用者名稱:fnd-upgrade.gen
密碼(令牌):AKCp5fUYZxwj7geWcaEbyKShGtyNxzA3ijWzzXdhuWY7GoR5RVYru2zcAta81fcV4Jndbjq31
作為影象標籤,使用前面介紹的版本號(例如4.7.0-101)。
下載映像後,使用選項2)Container Reload載入映像
輸出示例:
[root@iot-fnd ~]# /opt/fnd/scripts/upgrade.sh
This script must be run with root privileges.
Usage: Load container images: No resource required
For container reload: No resource required
1) Load container images
2) Container reload
3) Quit
Enter your choice: 1
Do you want to download docker image from registry (y/n)?y
Enter docker registry [devhub-docker.cisco.com]:
For FND Docker image upgrade you will need access to Cisco CCO docker registry.
Username: fnd-upgrade.gen
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
Enter docker image tag: 4.7.0-101
Downloading FND docker image...
4.7.0-101: Pulling from field-network-director-docker/fnd-image
f34b00c7da20: Already exists
9c542cd3c18f: Pull complete
b0929d67d1de: Pull complete
e82d75ddb5ee: Pull complete
95df7d16861d: Pull complete
184d612a5ba6: Pull complete
90d6558240a2: Pull complete
81a31ac85436: Pull complete
Digest: sha256:b7ef566386d318a2e186350077970a9b4f0019d455521c053cdd75c139f5627c
Status: Downloaded newer image for devhub-docker.cisco.com/field-network-director-docker/fnd-image:4.7.0-101
Downloading Fog Director docker image...
4.7.0-101: Pulling from fog-director-docker/fogd-image
ed6e0ec6b337: Pull complete
2c42dd52f029: Pull complete
6b4fd7880141: Pull complete
7d56b7ff004c: Pull complete
c719de3d527a: Pull complete
ccca86184ecc: Pull complete
b45dc2906bcc: Pull complete
e4f23b432923: Pull complete
Digest: sha256:39f3a30c63a06f0909337ffb9fa503d642e6c567343a04edb8f58b3a6962eced
Status: Downloaded newer image for devhub-docker.cisco.com/fog-director-docker/fogd-image:4.7.0-101
1) Load container images
2) Container reload
3) Quit
Enter your choice: 2
Stopping FND container...
fnd-container
Remove FND container...
fnd-container
Prune Docker container...
Starting FND container...
75c7d97e775d6345114ad940652ff80cbaf5dabbbf9e23e549202d6fe5e96b11
Stopping Fog Director container...
fogd-container
Remove Fog Director container...
fogd-container
Prune Docker container...
Starting Fog Director container...
1ca848a1b14155c8358eb0ff70fc7b0a55810743c531c4770f6e471e343f91ad
1) Load container images
2) Container reload
3) Quit
Enter your choice: 3
完成後,您可以透過以下命令檢查升級是否成功:
[root@iot-fnd ~]# docker exec -it fnd-container cat /opt/cgms/bin/version
4.7.0-101