简体   繁体   中英

Virtual Kubelet with AKS

I followed the doc here When I tried to create a virtual service for Windows, I get error: The Deployment "nanoserver-iis" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"nanoserver-iis"}: selector does not match template labels

kubectl get nodes

`NAME                                               STATUS    ROLES     AGE       
VERSION
aks-agentpool-27326293-0                           Ready     agent     15m       
v1.11.3
virtual-kubelet-aci-connector-windows-westeurope   Ready     agent     9s        
v1.11.2`

virtual-kubelet-windows.yaml

apiVersion: apps/v1 kind: Deployment metadata: name: nanoserver-iis spec: replicas: 1 selector: matchLabels: app: aci-helloworld template: metadata: labels: app: nanoserver-iis spec: containers: - name: nanoserver-iis image: microsoft/iis:nanoserver ports: - containerPort: 80 nodeSelector: kubernetes.io/hostname: virtual-kubelet-aci-connector-windows-westeurope tolerations: - key: virtual-kubelet.io/provider operator: Equal value: azure effect: NoSchedule

Try updating the deployment definition with the following. There is an inconsistency in the YAML definition where labels don't match. Labels in the matchLabeles field and labels in the metadata field need to match. In the deployment definition, they are set to different values aci-helloworld and nanoserver-iis respectively.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nanoserver-iis
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nanoserver-iis
  template:
  metadata:
    labels:
      app: nanoserver-iis
  spec:
    containers:
    - name: nanoserver-iis
      image: microsoft/iis:nanoserver
      ports:
    - containerPort: 80
    nodeSelector:
      kubernetes.io/hostname: virtual-kubelet-aci-connector-windows-westeurope
    tolerations:
    - key: virtual-kubelet.io/provider
      operator: Equal
      value: azure
      effect: NoSchedule

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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