我想在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服务,我以前没有部署过,我错过了什么吗?
谢谢
答案 0 :(得分:2)
鉴于windowskube.azurecr.io/windowsimage:v1
似乎是您的私有Azure容器注册表,我认为缺少的部分是为kubernetes提供了到私有注册表的登录凭据。
请参阅:https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
如前所述,通过执行kubectl describe pod windowsservice-deploy-5994764596-jfghj
并向下滚动至底部以查看Events
,您会得到更好的错误消息,说明为什么图像提取失败。
答案 1 :(得分:2)
默认情况下,将使用可运行Linux容器的节点池创建AKS集群。使用az aks nodepool
add命令添加一个可以在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
遵循本完整指南here