問題:Kubernetes創建Pod失敗,無法獲取image
Failed create pod sandbox: rpc error: code = Unknown desc = failed pulling image "harbor.od.com/public/pause:latest": Error response from daemon: Get http://harbor.od.com/v2/public/pause/manifests/latest: Get http://harbor.od.com:180/service/token?scope=repository%3Apublic%2Fpause%3Apull&service=harbor-registry: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers
環境:
harbor.od.com二進制包安裝,使用docker-compose啟動,
harbor.yaml配置port:180
然后通過部署nginx,反向到后端harbor上
故障排查:
1.使用docker pull 倉庫鏡像也無法獲取
Error response from daemon: Get http://harbor.od.com/v2/public/pause/manifests/latest: Get http://harbor.od.com:180/service/token?scope=repository%3Apublic%2Fpaue%3Apull&service=harbor-registry: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2.使用docker loginx登錄Harbor
Error response from daemon: Get https://harbor,od,com/v2/: dial tcp: lookup harbor,od,com: no such host
3.修改成使用IP的方式登錄Harbor
Error response from daemon: Get http://harbor.od.com/v2/: Get http://harbor.od.com:180/service/token?account=admin&client_id=docker&offline_token=true&service=habor-registry: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
分析問題:
docker使用Http請求獲取鏡像,harbor是通過nginx的80端口訪問,但是通過Log上看到的是使用Get方式,另外還要帶有域名加180端口方式驗證,應該是配置問題引起
#https://www.cnblogs.com/liucx/
解決問題:
修改harbor.yml配置文件,取消external_url注釋,設置為:
external_url: http://harbor.od.com:80
然后,docker-compose down停止所有服務,刪除當前配置目錄:rm -rf ./common/config下配置清單,重新執行install.sh生成配置,即可解決
配置大概解釋:如果使用外部代理就要啟動該項
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used