問題:Kubernetes建立Pod失敗,沒法獲取imagenginx
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 headersdocker
環境:
harbor.od.com二進制包安裝,使用docker-compose啓動,
harbor.yaml配置port:180
而後經過部署nginx,反向到後端harbor上後端
故障排查:tcp
1.使用docker pull 倉庫鏡像也沒法獲取url
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)spa
2.使用docker loginx登陸Harbor代理
Error response from daemon: Get https://harbor,od,com/v2/: dial tcp: lookup harbor,od,com: no such hostcode
3.修改爲使用IP的方式登陸Harborblog
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)token
分析問題:
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