繁体   English   中英

将简单 docker 容器部署到 Azure Kubernetes 时出错

[英]Error deploying simple docker container to Azure Kubernetes

我是 Azure kubernetes 的新手。 I'm trying to deploy a simple .net core web api to Azure Kubernetes. 我刚刚在 VS 2019 中创建了默认天气项目。我可以在 Docker 本地运行它。 我还可以毫无问题地将图像推送到 Azure 容器存储库。

当我这样做时,我得到了错误:

kubectl apply -f .\deployment.yml  

当我在部署后运行 kubectl get pods 时,我看到了这一点。

| 姓名 | 准备好了 | 状态 | 重启 | 年龄 |

| 测试部署-7564d94c8f-fdz9q | 0/1 | ImagePullBackOff |
0 | 74s |

所以我跑了kubectl describe pod test-deployment-7564d94c8f-fdz9q

这些是回来的错误

警告失败(x4 超过 15 秒)kubelet,aks-agentpool-30270636-vmss000000

无法拉取映像“ipaspoccontreg.azurecr.io/test:dev”:[rpc 错误:代码 = 未知 desc = 映像操作系统“windows”无法在此平台上使用,rpc 错误:代码 = 未知 desc = 来自守护程序的错误响应:获取https://ipaspoccontreg.azurecr.io/v2/test/manifests/dev :未经授权:需要身份验证]

我的 deployment.yml 是

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
spec:
  selector:
    matchLabels:
      app: test-pod
  template:
    metadata:
      labels:
        app: test-pod
    spec:
      containers:
      - name: test-container
        image: ipaspoccontreg.azurecr.io/test:dev
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 80

我的 service.yml 是

apiVersion: v1
kind: Service
metadata:
  name: test-service
spec:
  selector:
    app: test-pod
  ports:
  - port: 8080
    targetPort: 80
  type: LoadBalancer

您需要在 Kubernetes 中创建一个秘密,其中将包含您的容器注册表凭据。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM