在azure kubernetes集群中部署windows服务。

问题描述 投票:1回答:1

我想在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 describe 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服务,我之前没有部署在上面,我是不是漏掉了什么?

谅谅

azure kubernetes windows-services
1个回答
1
投票

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

请参见 https:/kubernetes.iodocstasksconfigure-pod-containerpull-imag-private-registry。

如前所述,通过做 kubectl describe pod windowsservice-deploy-5994764596-jfghj 并向下滚动到底部查看。Events,你会得到一个更好的错误信息,描述为什么图像拉动失败。


1
投票

默认情况下,创建的AKS集群有一个可以运行Linux容器的节点池。使用 az aks nodepool 添加命令来添加一个额外的节点池,该节点池可以与Linux节点池一起运行Windows Server容器。

az aks nodepool add \
    --resource-group myResourceGroup \
    --cluster-name myAKSCluster \
    --os-type Windows \
    --name npwin \
    --node-count 1 \
    --kubernetes-version 1.16.9

请遵循以下完整指南 此处

© www.soinside.com 2019 - 2024. All rights reserved.