[英]How to deploy docker container with azure devops in Kubernetes?
[英]How to deploy the image from JFrog Artifactory into Azure Kubernetes service using Azure DevOps
我使用 Azure DevOps 構建管道構建 docker 映像並將其推送到 JFrog Artifactory。 然后使用發布定義中的 Kubectl 任務使用下面的 yaml 文件將映像部署到 Azure AKS 環境中。
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: webapplication-jfrog-deployment
name: webapplication-jfrog-deployment
spec:
replicas: 2
selector:
matchLabels:
app: webapplication-jfrog
template:
metadata:
labels:
app: webapplication-jfrog
spec:
containers:
-
image: #{JFrog_Login_Server_Name}#/webapplication:#{Version}#
imagePullPolicy: Always
name: webapplication-jfrog
ports:
-
containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: webapplication-jfrog-service
spec:
ports:
-
port: 80
selector:
app: webapplication-jfrog
type: LoadBalancer
部署上述 yaml 文件后,我在 pod 中收到以下錯誤:
無法提取圖像“xxxx-poc.jfrog.io/webapplication:xx”:rpc 錯誤:代碼 = 未知 desc = 來自守護進程的錯誤響應:獲取https://xxxx-poc.jfrog.io/v2/webapplication/manifests/ xx :未知:需要身份驗證
發生此錯誤可能是身份驗證問題,同時將圖像從 JFrog Artifactory 拉入 Azure AKS 環境。
那么,誰能建議我如何將 JFrog Artifactory 中的圖像部署到 Azure Kubernetes 服務中。
對於任何私有注冊表,您需要創建一個docker-registry
密碼,並在使用imagePullSecrets
拉取圖像時指定該密碼。
kubectl create secret docker-registry artifactorycred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: <your-private-image>
imagePullSecrets:
- name: artifactorycred
有關詳細信息,請參閱以下文檔:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.