2017-03-01 97 views
1

我有一個scala應用程序。我已經將docker鏡像推到了一個私人註冊表中。現在,據我所知,我需要創建一個祕密,使用yaml文件從私有存儲庫中提取圖像。Kubernetes - 從私人碼頭註冊表中提取錯誤

我曾嘗試使用下面的命令創建一個祕密:

kubectl create secret docker-registry regsecret --docker-username=token --docker-password=<private repo password> --docker-email=<email id which I use to access the private repo> 

這成功地創建了一個祕密。

圖片現推送至 圖片名稱爲「imagecheck」,回購商品名稱爲「repocheck」。 現在,當我嘗試從我的YAML文件中提取圖像,它提供了一個錯誤說

未能拉形象「abc.somerepo.com/repocheck/imagecheck:latest」:像拉失敗ABC。 somerepo.com/repocheck/imagecheck:latest,這可能是因爲有這個請求沒有憑據

這是我的YAML文件:

apiVersion: extensions/v1beta1 
kind: Deployment 
metadata: 
    name: onlinescoring 
spec: 
    replicas: 4 # tells deployment to run 2 pods matching the template 
    strategy: 
    type: RollingUpdate 
    rollingUpdate: 
     maxUnavailable: 1 
     maxSurge: 0 
    template: # create pods using pod definition in this template 
    metadata: 
     labels: 
     app: online1 
    spec: 
     containers: 
     - name: cont1 
     image: abc.somerepo.com/repocheck/imagecheck:latest 
     ports: 
     - containerPort: 32014 
     imagePullSecrets: 
     - name: regsecret 

我能夠從我的終端拉圖像。請指導如何解決錯誤。

在此先感謝!

回答

3

刪除的祕密,並使用重新創建:

kubectl create secret docker-registry regsecret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=token --docker-password=<private repo password> --docker-email=<email id which I use to access the private repo> 

更換DOCKER_REGISTRY_SERVER與私有註冊網址。

默認值:https://index.docker.io/v1/

+0

謝謝:)這工作。 – Tarun