<p>Please help me. I'm following this guide: <a href="https://pleasereleaseme.net/deploy-a-dockerized-asp-net-core-application-to-kubernetes-on-azure-using-a-vsts-ci-cd-pipeline-part-1/" rel="nofollow noreferrer">https://pleasereleaseme.net/deploy-a-dockerized-asp-net-core-application-to-kubernetes-on-azure-using-a-vsts-ci-cd-pipeline-part-1/</a>. My docker images is successfully built and pushed to my private container registry and my CD pipeline is okay as well. But when I tried to check it using kubectl get pods the status is always pending, when I tried to use <code>kubectl describe pod k8s-aspnetcore-deployment-64648bb5ff-fxg2k</code> the message is:</p>

<pre><code>Name:           k8s-aspnetcore-deployment-64648bb5ff-fxg2k
Namespace:      default
Node:           &lt;none&gt;
Labels:         app=k8s-aspnetcore
                pod-template-hash=2020466199
Annotations:    &lt;none&gt;
Status:         Pending
IP:
Controlled By:  ReplicaSet/k8s-aspnetcore-deployment-64648bb5ff
Containers:
  k8s-aspnetcore:
    Image:        mycontainerregistryb007.azurecr.io/k8saspnetcore:2033
    Port:         80/TCP
    Environment:  &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-tr892 (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  default-token-tr892:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-tr892
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  beta.kubernetes.io/os=windows
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  3m (x57 over 19m)  default-scheduler  0/1 nodes are available: 1 MatchNodeSelector.
</code></pre>

<p>Here is for kubectl describe deployment:</p>

<pre><code>Name:                   k8s-aspnetcore-deployment
Namespace:              default
CreationTimestamp:      Sat, 21 Jul 2018 13:41:52 +0000
Labels:                 app=k8s-aspnetcore
Annotations:            deployment.kubernetes.io/revision=2
Selector:               app=k8s-aspnetcore
Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        5
RollingUpdateStrategy:  1 max unavailable, 1 max surge
Pod Template:
  Labels:  app=k8s-aspnetcore
  Containers:
   k8s-aspnetcore:
    Image:        mycontainerregistryb007.azurecr.io/k8saspnetcore:2033
    Port:         80/TCP
    Environment:  &lt;none&gt;
    Mounts:       &lt;none&gt;
  Volumes:        &lt;none&gt;
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
OldReplicaSets:  &lt;none&gt;
NewReplicaSet:   k8s-aspnetcore-deployment-64648bb5ff (1/1 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  26m   deployment-controller  Scaled up replica set k8s-aspnetcore-deployment-7f756cc78c to 1
  Normal  ScalingReplicaSet  26m   deployment-controller  Scaled up replica set k8s-aspnetcore-deployment-64648bb5ff to 1
  Normal  ScalingReplicaSet  26m   deployment-controller  Scaled down replica set k8s-aspnetcore-deployment-7f756cc78c to 0
</code></pre>

<p>Here is for kubectl describe service:</p>

<pre><code>Name:                     k8s-aspnetcore-service
Namespace:                default
Labels:                   version=test
Annotations:              &lt;none&gt;
Selector:                 app=k8s-aspnetcore
Type:                     LoadBalancer
IP:                       10.0.26.188
LoadBalancer Ingress:     40.112.73.28
Port:                     &lt;unset&gt;  80/TCP
TargetPort:               80/TCP
NodePort:                 &lt;unset&gt;  30282/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason                Age   From                Message
  ----    ------                ----  ----                -------
  Normal  EnsuringLoadBalancer  26m   service-controller  Ensuring load balancer
  Normal  EnsuredLoadBalancer   25m   service-controller  Ensured load balancer
</code></pre>

<p>I don't know if my setup for Kubernetes Cluster is wrong, but here is the script I used:</p>

<pre><code>#!/bin/bash

azureSubscriptionId="xxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx"
resourceGroup="k8sResourceGroup"
clusterName="k8sCluster"
location="northeurope"

# Useful if you have more than one Aure subscription
az account set --subscription $azureSubscriptionId

# Resource group for cluster - only availble in certain regions at time of writing
az group create --location $location --name $resourceGroup

# Create actual cluster
az aks create --resource-group $resourceGroup --name $clusterName --node-count 1 --generate-ssh-keys

# Creates a config file at ~/.kube on local machine to tell kubectl which cluster it should work with
az aks get-credentials --resource-group $resourceGroup --name $clusterName
</code></pre>

<p>Here is my deployment.yaml:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: k8s-aspnetcore-deployment
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  template:
    metadata:
      labels:
        app: k8s-aspnetcore
    spec:
      containers:
      - name: k8s-aspnetcore
        image: mycontainerregistryb007.azurecr.io/k8saspnetcore
        ports:
        - containerPort: 80
      imagePullSecrets:
        - name: k8ssecret
      nodeSelector:
        "beta.kubernetes.io/os": windows
</code></pre>

<p>Here is my service.yaml:</p>

<pre><code>kind: Service
metadata:
  name: k8s-aspnetcore-service
  labels:
    version: test
spec:
  selector:
    app: k8s-aspnetcore
  ports:
  - port: 80
  type: LoadBalancer
</code></pre>

jravenger4
<p>The reason they are in Pending state is described in the message at the bottom of the <code>describe pod</code> output: <code>MatchNodeSelector</code>. That means Kubernetes didn't find a Node in your cluster that was able to fulfill the Node selection criteria specified in the PodSpec.</p>

<p>Specifically, it's very likely these lines:</p>

<pre><code>nodeSelector:
    "beta.kubernetes.io/os": windows
</code></pre>

<p>Only a <code>kubectl describe nodes</code> would tell if there are any Nodes that could possibly fulfill that criteria</p>
