azure - 在azure kubernetes集群中部署Windows服务

标签 azure kubernetes windows-services

我想在azure集群中部署Windows服务。我已经创建了用于部署服务的 yaml 文件,但是当我运行 kubectr get pods 时,我得到以下内容,

NAME                                    READY   STATUS             RESTARTS   AGE
windowsservice-deploy-5994764596-jfghj   0/1     ImagePullBackOff   0          39m

我的 yaml 文件如下所示,

apiVersion: apps/v1
kind: Deployment
metadata:
  name: windowsservice-deploy
  labels:
    app: windowsservice
spec:
  replicas: 1
  template:
    metadata:
      name: windowsservice
      labels:
        app: windowsservice
    spec:
      containers:
      - name: windowsservice
        image: windowskube.azurecr.io/windowsimage:v1
        imagePullPolicy: IfNotPresent
      restartPolicy: Always
  selector:
    matchLabels:
      app: windowsservice


---

apiVersion: v1
kind: Service
metadata:
  name: windows-service
spec:
  selector:
    app: windowsservice
  ports:
    - port: 80
  type: LoadBalancer

这是输出 kubectl 描述 pod windowsservice-deploy-5994764596-jfghj

Name:           windowsservice-deploy-5994764596-jfghj
Namespace:      default
Priority:       0
Node:           aks-nodepool1-41533414-vmss000000/10.240.0.4
Start Time:     Mon, 15 Jun 2020 11:24:18 +0100
Labels:         app=windowsservice
                pod-template-hash=5994764596
Annotations:    <none>
Status:         Pending
IP:             10.244.0.8
IPs:            <none>
Controlled By:  ReplicaSet/windowsservice-deploy-5994764596
Containers:
  workerservice:
    Container ID:
    Image:          windowskube.azurecr.io/windowsimage:v1
    Image ID:
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-zvwh8 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-zvwh8:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-zvwh8
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason   Age                    From                                        Message
  ----     ------   ----                   ----                                        -------
  Warning  Failed   18m (x330 over 93m)    kubelet, aks-nodepool1-41533414-vmss000000  Error: ImagePullBackOff
  Normal   BackOff  3m11s (x395 over 93m)  kubelet, aks-nodepool1-41533414-vmss000000  Back-off pulling image "windowskube.azurecr.io/windowsimage:v1"

这是一个 Windows 服务,我以前没有部署过,我是否遗漏了什么?

谢谢

最佳答案

鉴于 windowskube.azurecr.io/windowsimage:v1 似乎是您的私有(private) Azure 容器注册表,我认为缺少的部分是为 kubernetes 提供私有(private)注册表的登录凭据。

参见:https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

正如前面提到的,通过执行kubectl描述pod windowsservice-deploy-5994764596-jfghj并向下滚动到底部查看事件,您将获得更好的错误消息描述了图像拉取失败的原因。

关于azure - 在azure kubernetes集群中部署Windows服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62387077/

相关文章:

windows-services - 如何监控Windows服务

c# - 如何在 Windows 应用程序中实现通知机制?

.net - 来自 Windows 服务的全局键盘 Hook

javascript - React JS 中的 MSAL 2.0 Auth - 隐身问题

Azure 认知搜索 int 到 Edm.String 字段问题

python - 使用 Python 的 Azure SQL Server 的 CICD

azure - 如何在 Cosmos DB 中查找重复文档

Docker 和服务集群

docker - 当多个容器在同一主机上运行时,docker 是否会重用图像?

amazon-web-services - 在 Kubernetes 上还是直接在 EC2 实例上部署 Docker 应用程序?